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

Dependencies:   Watchdog mbed Schedule SimpleFilter LSM303DLM PinDetect DebounceIn Servo

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers mavlink_msg_set_roll_pitch_yaw_thrust.h Source File

mavlink_msg_set_roll_pitch_yaw_thrust.h

00001 // MESSAGE SET_ROLL_PITCH_YAW_THRUST PACKING
00002 
00003 #define MAVLINK_MSG_ID_SET_ROLL_PITCH_YAW_THRUST 55
00004 
00005 typedef struct __mavlink_set_roll_pitch_yaw_thrust_t 
00006 {
00007     uint8_t target_system; ///< System ID
00008     uint8_t target_component; ///< Component ID
00009     float roll; ///< Desired roll angle in radians
00010     float pitch; ///< Desired pitch angle in radians
00011     float yaw; ///< Desired yaw angle in radians
00012     float thrust; ///< Collective thrust, normalized to 0 .. 1
00013 
00014 } mavlink_set_roll_pitch_yaw_thrust_t;
00015 
00016 
00017 
00018 /**
00019  * @brief Pack a set_roll_pitch_yaw_thrust message
00020  * @param system_id ID of this system
00021  * @param component_id ID of this component (e.g. 200 for IMU)
00022  * @param msg The MAVLink message to compress the data into
00023  *
00024  * @param target_system System ID
00025  * @param target_component Component ID
00026  * @param roll Desired roll angle in radians
00027  * @param pitch Desired pitch angle in radians
00028  * @param yaw Desired yaw angle in radians
00029  * @param thrust Collective thrust, normalized to 0 .. 1
00030  * @return length of the message in bytes (excluding serial stream start sign)
00031  */
00032 static inline uint16_t mavlink_msg_set_roll_pitch_yaw_thrust_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, uint8_t target_system, uint8_t target_component, float roll, float pitch, float yaw, float thrust)
00033 {
00034     uint16_t i = 0;
00035     msg->msgid = MAVLINK_MSG_ID_SET_ROLL_PITCH_YAW_THRUST;
00036 
00037     i += put_uint8_t_by_index(target_system, i, msg->payload); // System ID
00038     i += put_uint8_t_by_index(target_component, i, msg->payload); // Component ID
00039     i += put_float_by_index(roll, i, msg->payload); // Desired roll angle in radians
00040     i += put_float_by_index(pitch, i, msg->payload); // Desired pitch angle in radians
00041     i += put_float_by_index(yaw, i, msg->payload); // Desired yaw angle in radians
00042     i += put_float_by_index(thrust, i, msg->payload); // Collective thrust, normalized to 0 .. 1
00043 
00044     return mavlink_finalize_message(msg, system_id, component_id, i);
00045 }
00046 
00047 /**
00048  * @brief Pack a set_roll_pitch_yaw_thrust message
00049  * @param system_id ID of this system
00050  * @param component_id ID of this component (e.g. 200 for IMU)
00051  * @param chan The MAVLink channel this message was sent over
00052  * @param msg The MAVLink message to compress the data into
00053  * @param target_system System ID
00054  * @param target_component Component ID
00055  * @param roll Desired roll angle in radians
00056  * @param pitch Desired pitch angle in radians
00057  * @param yaw Desired yaw angle in radians
00058  * @param thrust Collective thrust, normalized to 0 .. 1
00059  * @return length of the message in bytes (excluding serial stream start sign)
00060  */
00061 static inline uint16_t mavlink_msg_set_roll_pitch_yaw_thrust_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, float roll, float pitch, float yaw, float thrust)
00062 {
00063     uint16_t i = 0;
00064     msg->msgid = MAVLINK_MSG_ID_SET_ROLL_PITCH_YAW_THRUST;
00065 
00066     i += put_uint8_t_by_index(target_system, i, msg->payload); // System ID
00067     i += put_uint8_t_by_index(target_component, i, msg->payload); // Component ID
00068     i += put_float_by_index(roll, i, msg->payload); // Desired roll angle in radians
00069     i += put_float_by_index(pitch, i, msg->payload); // Desired pitch angle in radians
00070     i += put_float_by_index(yaw, i, msg->payload); // Desired yaw angle in radians
00071     i += put_float_by_index(thrust, i, msg->payload); // Collective thrust, normalized to 0 .. 1
00072 
00073     return mavlink_finalize_message_chan(msg, system_id, component_id, chan, i);
00074 }
00075 
00076 /**
00077  * @brief Encode a set_roll_pitch_yaw_thrust struct into a message
00078  *
00079  * @param system_id ID of this system
00080  * @param component_id ID of this component (e.g. 200 for IMU)
00081  * @param msg The MAVLink message to compress the data into
00082  * @param set_roll_pitch_yaw_thrust C-struct to read the message contents from
00083  */
00084 static inline uint16_t mavlink_msg_set_roll_pitch_yaw_thrust_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_set_roll_pitch_yaw_thrust_t* set_roll_pitch_yaw_thrust)
00085 {
00086     return mavlink_msg_set_roll_pitch_yaw_thrust_pack(system_id, component_id, msg, set_roll_pitch_yaw_thrust->target_system, set_roll_pitch_yaw_thrust->target_component, set_roll_pitch_yaw_thrust->roll, set_roll_pitch_yaw_thrust->pitch, set_roll_pitch_yaw_thrust->yaw, set_roll_pitch_yaw_thrust->thrust);
00087 }
00088 
00089 /**
00090  * @brief Send a set_roll_pitch_yaw_thrust message
00091  * @param chan MAVLink channel to send the message
00092  *
00093  * @param target_system System ID
00094  * @param target_component Component ID
00095  * @param roll Desired roll angle in radians
00096  * @param pitch Desired pitch angle in radians
00097  * @param yaw Desired yaw angle in radians
00098  * @param thrust Collective thrust, normalized to 0 .. 1
00099  */
00100 #ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS
00101 
00102 static inline void mavlink_msg_set_roll_pitch_yaw_thrust_send(mavlink_channel_t chan, uint8_t target_system, uint8_t target_component, float roll, float pitch, float yaw, float thrust)
00103 {
00104     mavlink_message_t msg;
00105     mavlink_msg_set_roll_pitch_yaw_thrust_pack_chan(mavlink_system.sysid, mavlink_system.compid, chan, &msg, target_system, target_component, roll, pitch, yaw, thrust);
00106     mavlink_send_uart(chan, &msg);
00107 }
00108 
00109 #endif
00110 // MESSAGE SET_ROLL_PITCH_YAW_THRUST UNPACKING
00111 
00112 /**
00113  * @brief Get field target_system from set_roll_pitch_yaw_thrust message
00114  *
00115  * @return System ID
00116  */
00117 static inline uint8_t mavlink_msg_set_roll_pitch_yaw_thrust_get_target_system(const mavlink_message_t* msg)
00118 {
00119     return (uint8_t)(msg->payload)[0];
00120 }
00121 
00122 /**
00123  * @brief Get field target_component from set_roll_pitch_yaw_thrust message
00124  *
00125  * @return Component ID
00126  */
00127 static inline uint8_t mavlink_msg_set_roll_pitch_yaw_thrust_get_target_component(const mavlink_message_t* msg)
00128 {
00129     return (uint8_t)(msg->payload+sizeof(uint8_t))[0];
00130 }
00131 
00132 /**
00133  * @brief Get field roll from set_roll_pitch_yaw_thrust message
00134  *
00135  * @return Desired roll angle in radians
00136  */
00137 static inline float mavlink_msg_set_roll_pitch_yaw_thrust_get_roll(const mavlink_message_t* msg)
00138 {
00139     generic_32bit r;
00140     r.b[3] = (msg->payload+sizeof(uint8_t)+sizeof(uint8_t))[0];
00141     r.b[2] = (msg->payload+sizeof(uint8_t)+sizeof(uint8_t))[1];
00142     r.b[1] = (msg->payload+sizeof(uint8_t)+sizeof(uint8_t))[2];
00143     r.b[0] = (msg->payload+sizeof(uint8_t)+sizeof(uint8_t))[3];
00144     return (float)r.f;
00145 }
00146 
00147 /**
00148  * @brief Get field pitch from set_roll_pitch_yaw_thrust message
00149  *
00150  * @return Desired pitch angle in radians
00151  */
00152 static inline float mavlink_msg_set_roll_pitch_yaw_thrust_get_pitch(const mavlink_message_t* msg)
00153 {
00154     generic_32bit r;
00155     r.b[3] = (msg->payload+sizeof(uint8_t)+sizeof(uint8_t)+sizeof(float))[0];
00156     r.b[2] = (msg->payload+sizeof(uint8_t)+sizeof(uint8_t)+sizeof(float))[1];
00157     r.b[1] = (msg->payload+sizeof(uint8_t)+sizeof(uint8_t)+sizeof(float))[2];
00158     r.b[0] = (msg->payload+sizeof(uint8_t)+sizeof(uint8_t)+sizeof(float))[3];
00159     return (float)r.f;
00160 }
00161 
00162 /**
00163  * @brief Get field yaw from set_roll_pitch_yaw_thrust message
00164  *
00165  * @return Desired yaw angle in radians
00166  */
00167 static inline float mavlink_msg_set_roll_pitch_yaw_thrust_get_yaw(const mavlink_message_t* msg)
00168 {
00169     generic_32bit r;
00170     r.b[3] = (msg->payload+sizeof(uint8_t)+sizeof(uint8_t)+sizeof(float)+sizeof(float))[0];
00171     r.b[2] = (msg->payload+sizeof(uint8_t)+sizeof(uint8_t)+sizeof(float)+sizeof(float))[1];
00172     r.b[1] = (msg->payload+sizeof(uint8_t)+sizeof(uint8_t)+sizeof(float)+sizeof(float))[2];
00173     r.b[0] = (msg->payload+sizeof(uint8_t)+sizeof(uint8_t)+sizeof(float)+sizeof(float))[3];
00174     return (float)r.f;
00175 }
00176 
00177 /**
00178  * @brief Get field thrust from set_roll_pitch_yaw_thrust message
00179  *
00180  * @return Collective thrust, normalized to 0 .. 1
00181  */
00182 static inline float mavlink_msg_set_roll_pitch_yaw_thrust_get_thrust(const mavlink_message_t* msg)
00183 {
00184     generic_32bit r;
00185     r.b[3] = (msg->payload+sizeof(uint8_t)+sizeof(uint8_t)+sizeof(float)+sizeof(float)+sizeof(float))[0];
00186     r.b[2] = (msg->payload+sizeof(uint8_t)+sizeof(uint8_t)+sizeof(float)+sizeof(float)+sizeof(float))[1];
00187     r.b[1] = (msg->payload+sizeof(uint8_t)+sizeof(uint8_t)+sizeof(float)+sizeof(float)+sizeof(float))[2];
00188     r.b[0] = (msg->payload+sizeof(uint8_t)+sizeof(uint8_t)+sizeof(float)+sizeof(float)+sizeof(float))[3];
00189     return (float)r.f;
00190 }
00191 
00192 /**
00193  * @brief Decode a set_roll_pitch_yaw_thrust message into a struct
00194  *
00195  * @param msg The message to decode
00196  * @param set_roll_pitch_yaw_thrust C-struct to decode the message contents into
00197  */
00198 static inline void mavlink_msg_set_roll_pitch_yaw_thrust_decode(const mavlink_message_t* msg, mavlink_set_roll_pitch_yaw_thrust_t* set_roll_pitch_yaw_thrust)
00199 {
00200     set_roll_pitch_yaw_thrust->target_system = mavlink_msg_set_roll_pitch_yaw_thrust_get_target_system(msg);
00201     set_roll_pitch_yaw_thrust->target_component = mavlink_msg_set_roll_pitch_yaw_thrust_get_target_component(msg);
00202     set_roll_pitch_yaw_thrust->roll = mavlink_msg_set_roll_pitch_yaw_thrust_get_roll(msg);
00203     set_roll_pitch_yaw_thrust->pitch = mavlink_msg_set_roll_pitch_yaw_thrust_get_pitch(msg);
00204     set_roll_pitch_yaw_thrust->yaw = mavlink_msg_set_roll_pitch_yaw_thrust_get_yaw(msg);
00205     set_roll_pitch_yaw_thrust->thrust = mavlink_msg_set_roll_pitch_yaw_thrust_get_thrust(msg);
00206 }