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_roll_pitch_yaw_thrust_setpoint.h Source File

mavlink_msg_roll_pitch_yaw_thrust_setpoint.h

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