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_roll_pitch_yaw_speed_thrust_setpoint.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 ROLL_PITCH_YAW_SPEED_THRUST_SETPOINT PACKING |
shimniok | 0:826c6171fc1b | 2 | |
shimniok | 0:826c6171fc1b | 3 | #define MAVLINK_MSG_ID_ROLL_PITCH_YAW_SPEED_THRUST_SETPOINT 58 |
shimniok | 0:826c6171fc1b | 4 | |
shimniok | 0:826c6171fc1b | 5 | typedef struct __mavlink_roll_pitch_yaw_speed_thrust_setpoint_t |
shimniok | 0:826c6171fc1b | 6 | { |
shimniok | 0:826c6171fc1b | 7 | uint64_t time_us; ///< Timestamp in micro seconds since unix epoch |
shimniok | 0:826c6171fc1b | 8 | float roll_speed; ///< Desired roll angular speed in rad/s |
shimniok | 0:826c6171fc1b | 9 | float pitch_speed; ///< Desired pitch angular speed in rad/s |
shimniok | 0:826c6171fc1b | 10 | float yaw_speed; ///< Desired yaw angular speed in rad/s |
shimniok | 0:826c6171fc1b | 11 | float thrust; ///< Collective thrust, normalized to 0 .. 1 |
shimniok | 0:826c6171fc1b | 12 | |
shimniok | 0:826c6171fc1b | 13 | } mavlink_roll_pitch_yaw_speed_thrust_setpoint_t; |
shimniok | 0:826c6171fc1b | 14 | |
shimniok | 0:826c6171fc1b | 15 | |
shimniok | 0:826c6171fc1b | 16 | |
shimniok | 0:826c6171fc1b | 17 | /** |
shimniok | 0:826c6171fc1b | 18 | * @brief Pack a roll_pitch_yaw_speed_thrust_setpoint message |
shimniok | 0:826c6171fc1b | 19 | * @param system_id ID of this system |
shimniok | 0:826c6171fc1b | 20 | * @param component_id ID of this component (e.g. 200 for IMU) |
shimniok | 0:826c6171fc1b | 21 | * @param msg The MAVLink message to compress the data into |
shimniok | 0:826c6171fc1b | 22 | * |
shimniok | 0:826c6171fc1b | 23 | * @param time_us Timestamp in micro seconds since unix epoch |
shimniok | 0:826c6171fc1b | 24 | * @param roll_speed Desired roll angular speed in rad/s |
shimniok | 0:826c6171fc1b | 25 | * @param pitch_speed Desired pitch angular speed in rad/s |
shimniok | 0:826c6171fc1b | 26 | * @param yaw_speed Desired yaw angular speed in rad/s |
shimniok | 0:826c6171fc1b | 27 | * @param thrust Collective thrust, normalized to 0 .. 1 |
shimniok | 0:826c6171fc1b | 28 | * @return length of the message in bytes (excluding serial stream start sign) |
shimniok | 0:826c6171fc1b | 29 | */ |
shimniok | 0:826c6171fc1b | 30 | static inline uint16_t mavlink_msg_roll_pitch_yaw_speed_thrust_setpoint_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, uint64_t time_us, float roll_speed, float pitch_speed, float yaw_speed, float thrust) |
shimniok | 0:826c6171fc1b | 31 | { |
shimniok | 0:826c6171fc1b | 32 | uint16_t i = 0; |
shimniok | 0:826c6171fc1b | 33 | msg->msgid = MAVLINK_MSG_ID_ROLL_PITCH_YAW_SPEED_THRUST_SETPOINT; |
shimniok | 0:826c6171fc1b | 34 | |
shimniok | 0:826c6171fc1b | 35 | i += put_uint64_t_by_index(time_us, i, msg->payload); // Timestamp in micro seconds since unix epoch |
shimniok | 0:826c6171fc1b | 36 | i += put_float_by_index(roll_speed, i, msg->payload); // Desired roll angular speed in rad/s |
shimniok | 0:826c6171fc1b | 37 | i += put_float_by_index(pitch_speed, i, msg->payload); // Desired pitch angular speed in rad/s |
shimniok | 0:826c6171fc1b | 38 | i += put_float_by_index(yaw_speed, i, msg->payload); // Desired yaw angular speed in rad/s |
shimniok | 0:826c6171fc1b | 39 | i += put_float_by_index(thrust, i, msg->payload); // Collective thrust, normalized to 0 .. 1 |
shimniok | 0:826c6171fc1b | 40 | |
shimniok | 0:826c6171fc1b | 41 | return mavlink_finalize_message(msg, system_id, component_id, i); |
shimniok | 0:826c6171fc1b | 42 | } |
shimniok | 0:826c6171fc1b | 43 | |
shimniok | 0:826c6171fc1b | 44 | /** |
shimniok | 0:826c6171fc1b | 45 | * @brief Pack a roll_pitch_yaw_speed_thrust_setpoint message |
shimniok | 0:826c6171fc1b | 46 | * @param system_id ID of this system |
shimniok | 0:826c6171fc1b | 47 | * @param component_id ID of this component (e.g. 200 for IMU) |
shimniok | 0:826c6171fc1b | 48 | * @param chan The MAVLink channel this message was sent over |
shimniok | 0:826c6171fc1b | 49 | * @param msg The MAVLink message to compress the data into |
shimniok | 0:826c6171fc1b | 50 | * @param time_us Timestamp in micro seconds since unix epoch |
shimniok | 0:826c6171fc1b | 51 | * @param roll_speed Desired roll angular speed in rad/s |
shimniok | 0:826c6171fc1b | 52 | * @param pitch_speed Desired pitch angular speed in rad/s |
shimniok | 0:826c6171fc1b | 53 | * @param yaw_speed Desired yaw angular speed in rad/s |
shimniok | 0:826c6171fc1b | 54 | * @param thrust Collective thrust, normalized to 0 .. 1 |
shimniok | 0:826c6171fc1b | 55 | * @return length of the message in bytes (excluding serial stream start sign) |
shimniok | 0:826c6171fc1b | 56 | */ |
shimniok | 0:826c6171fc1b | 57 | static inline uint16_t mavlink_msg_roll_pitch_yaw_speed_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_speed, float pitch_speed, float yaw_speed, float thrust) |
shimniok | 0:826c6171fc1b | 58 | { |
shimniok | 0:826c6171fc1b | 59 | uint16_t i = 0; |
shimniok | 0:826c6171fc1b | 60 | msg->msgid = MAVLINK_MSG_ID_ROLL_PITCH_YAW_SPEED_THRUST_SETPOINT; |
shimniok | 0:826c6171fc1b | 61 | |
shimniok | 0:826c6171fc1b | 62 | i += put_uint64_t_by_index(time_us, i, msg->payload); // Timestamp in micro seconds since unix epoch |
shimniok | 0:826c6171fc1b | 63 | i += put_float_by_index(roll_speed, i, msg->payload); // Desired roll angular speed in rad/s |
shimniok | 0:826c6171fc1b | 64 | i += put_float_by_index(pitch_speed, i, msg->payload); // Desired pitch angular speed in rad/s |
shimniok | 0:826c6171fc1b | 65 | i += put_float_by_index(yaw_speed, i, msg->payload); // Desired yaw angular speed in rad/s |
shimniok | 0:826c6171fc1b | 66 | i += put_float_by_index(thrust, i, msg->payload); // Collective thrust, normalized to 0 .. 1 |
shimniok | 0:826c6171fc1b | 67 | |
shimniok | 0:826c6171fc1b | 68 | return mavlink_finalize_message_chan(msg, system_id, component_id, chan, i); |
shimniok | 0:826c6171fc1b | 69 | } |
shimniok | 0:826c6171fc1b | 70 | |
shimniok | 0:826c6171fc1b | 71 | /** |
shimniok | 0:826c6171fc1b | 72 | * @brief Encode a roll_pitch_yaw_speed_thrust_setpoint struct into a message |
shimniok | 0:826c6171fc1b | 73 | * |
shimniok | 0:826c6171fc1b | 74 | * @param system_id ID of this system |
shimniok | 0:826c6171fc1b | 75 | * @param component_id ID of this component (e.g. 200 for IMU) |
shimniok | 0:826c6171fc1b | 76 | * @param msg The MAVLink message to compress the data into |
shimniok | 0:826c6171fc1b | 77 | * @param roll_pitch_yaw_speed_thrust_setpoint C-struct to read the message contents from |
shimniok | 0:826c6171fc1b | 78 | */ |
shimniok | 0:826c6171fc1b | 79 | static inline uint16_t mavlink_msg_roll_pitch_yaw_speed_thrust_setpoint_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_roll_pitch_yaw_speed_thrust_setpoint_t* roll_pitch_yaw_speed_thrust_setpoint) |
shimniok | 0:826c6171fc1b | 80 | { |
shimniok | 0:826c6171fc1b | 81 | return mavlink_msg_roll_pitch_yaw_speed_thrust_setpoint_pack(system_id, component_id, msg, roll_pitch_yaw_speed_thrust_setpoint->time_us, roll_pitch_yaw_speed_thrust_setpoint->roll_speed, roll_pitch_yaw_speed_thrust_setpoint->pitch_speed, roll_pitch_yaw_speed_thrust_setpoint->yaw_speed, roll_pitch_yaw_speed_thrust_setpoint->thrust); |
shimniok | 0:826c6171fc1b | 82 | } |
shimniok | 0:826c6171fc1b | 83 | |
shimniok | 0:826c6171fc1b | 84 | /** |
shimniok | 0:826c6171fc1b | 85 | * @brief Send a roll_pitch_yaw_speed_thrust_setpoint message |
shimniok | 0:826c6171fc1b | 86 | * @param chan MAVLink channel to send the message |
shimniok | 0:826c6171fc1b | 87 | * |
shimniok | 0:826c6171fc1b | 88 | * @param time_us Timestamp in micro seconds since unix epoch |
shimniok | 0:826c6171fc1b | 89 | * @param roll_speed Desired roll angular speed in rad/s |
shimniok | 0:826c6171fc1b | 90 | * @param pitch_speed Desired pitch angular speed in rad/s |
shimniok | 0:826c6171fc1b | 91 | * @param yaw_speed Desired yaw angular speed in rad/s |
shimniok | 0:826c6171fc1b | 92 | * @param thrust Collective thrust, normalized to 0 .. 1 |
shimniok | 0:826c6171fc1b | 93 | */ |
shimniok | 0:826c6171fc1b | 94 | #ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS |
shimniok | 0:826c6171fc1b | 95 | |
shimniok | 0:826c6171fc1b | 96 | static inline void mavlink_msg_roll_pitch_yaw_speed_thrust_setpoint_send(mavlink_channel_t chan, uint64_t time_us, float roll_speed, float pitch_speed, float yaw_speed, float thrust) |
shimniok | 0:826c6171fc1b | 97 | { |
shimniok | 0:826c6171fc1b | 98 | mavlink_message_t msg; |
shimniok | 0:826c6171fc1b | 99 | mavlink_msg_roll_pitch_yaw_speed_thrust_setpoint_pack_chan(mavlink_system.sysid, mavlink_system.compid, chan, &msg, time_us, roll_speed, pitch_speed, yaw_speed, thrust); |
shimniok | 0:826c6171fc1b | 100 | mavlink_send_uart(chan, &msg); |
shimniok | 0:826c6171fc1b | 101 | } |
shimniok | 0:826c6171fc1b | 102 | |
shimniok | 0:826c6171fc1b | 103 | #endif |
shimniok | 0:826c6171fc1b | 104 | // MESSAGE ROLL_PITCH_YAW_SPEED_THRUST_SETPOINT UNPACKING |
shimniok | 0:826c6171fc1b | 105 | |
shimniok | 0:826c6171fc1b | 106 | /** |
shimniok | 0:826c6171fc1b | 107 | * @brief Get field time_us from roll_pitch_yaw_speed_thrust_setpoint message |
shimniok | 0:826c6171fc1b | 108 | * |
shimniok | 0:826c6171fc1b | 109 | * @return Timestamp in micro seconds since unix epoch |
shimniok | 0:826c6171fc1b | 110 | */ |
shimniok | 0:826c6171fc1b | 111 | static inline uint64_t mavlink_msg_roll_pitch_yaw_speed_thrust_setpoint_get_time_us(const mavlink_message_t* msg) |
shimniok | 0:826c6171fc1b | 112 | { |
shimniok | 0:826c6171fc1b | 113 | generic_64bit r; |
shimniok | 0:826c6171fc1b | 114 | r.b[7] = (msg->payload)[0]; |
shimniok | 0:826c6171fc1b | 115 | r.b[6] = (msg->payload)[1]; |
shimniok | 0:826c6171fc1b | 116 | r.b[5] = (msg->payload)[2]; |
shimniok | 0:826c6171fc1b | 117 | r.b[4] = (msg->payload)[3]; |
shimniok | 0:826c6171fc1b | 118 | r.b[3] = (msg->payload)[4]; |
shimniok | 0:826c6171fc1b | 119 | r.b[2] = (msg->payload)[5]; |
shimniok | 0:826c6171fc1b | 120 | r.b[1] = (msg->payload)[6]; |
shimniok | 0:826c6171fc1b | 121 | r.b[0] = (msg->payload)[7]; |
shimniok | 0:826c6171fc1b | 122 | return (uint64_t)r.ll; |
shimniok | 0:826c6171fc1b | 123 | } |
shimniok | 0:826c6171fc1b | 124 | |
shimniok | 0:826c6171fc1b | 125 | /** |
shimniok | 0:826c6171fc1b | 126 | * @brief Get field roll_speed from roll_pitch_yaw_speed_thrust_setpoint message |
shimniok | 0:826c6171fc1b | 127 | * |
shimniok | 0:826c6171fc1b | 128 | * @return Desired roll angular speed in rad/s |
shimniok | 0:826c6171fc1b | 129 | */ |
shimniok | 0:826c6171fc1b | 130 | static inline float mavlink_msg_roll_pitch_yaw_speed_thrust_setpoint_get_roll_speed(const mavlink_message_t* msg) |
shimniok | 0:826c6171fc1b | 131 | { |
shimniok | 0:826c6171fc1b | 132 | generic_32bit r; |
shimniok | 0:826c6171fc1b | 133 | r.b[3] = (msg->payload+sizeof(uint64_t))[0]; |
shimniok | 0:826c6171fc1b | 134 | r.b[2] = (msg->payload+sizeof(uint64_t))[1]; |
shimniok | 0:826c6171fc1b | 135 | r.b[1] = (msg->payload+sizeof(uint64_t))[2]; |
shimniok | 0:826c6171fc1b | 136 | r.b[0] = (msg->payload+sizeof(uint64_t))[3]; |
shimniok | 0:826c6171fc1b | 137 | return (float)r.f; |
shimniok | 0:826c6171fc1b | 138 | } |
shimniok | 0:826c6171fc1b | 139 | |
shimniok | 0:826c6171fc1b | 140 | /** |
shimniok | 0:826c6171fc1b | 141 | * @brief Get field pitch_speed from roll_pitch_yaw_speed_thrust_setpoint message |
shimniok | 0:826c6171fc1b | 142 | * |
shimniok | 0:826c6171fc1b | 143 | * @return Desired pitch angular speed in rad/s |
shimniok | 0:826c6171fc1b | 144 | */ |
shimniok | 0:826c6171fc1b | 145 | static inline float mavlink_msg_roll_pitch_yaw_speed_thrust_setpoint_get_pitch_speed(const mavlink_message_t* msg) |
shimniok | 0:826c6171fc1b | 146 | { |
shimniok | 0:826c6171fc1b | 147 | generic_32bit r; |
shimniok | 0:826c6171fc1b | 148 | r.b[3] = (msg->payload+sizeof(uint64_t)+sizeof(float))[0]; |
shimniok | 0:826c6171fc1b | 149 | r.b[2] = (msg->payload+sizeof(uint64_t)+sizeof(float))[1]; |
shimniok | 0:826c6171fc1b | 150 | r.b[1] = (msg->payload+sizeof(uint64_t)+sizeof(float))[2]; |
shimniok | 0:826c6171fc1b | 151 | r.b[0] = (msg->payload+sizeof(uint64_t)+sizeof(float))[3]; |
shimniok | 0:826c6171fc1b | 152 | return (float)r.f; |
shimniok | 0:826c6171fc1b | 153 | } |
shimniok | 0:826c6171fc1b | 154 | |
shimniok | 0:826c6171fc1b | 155 | /** |
shimniok | 0:826c6171fc1b | 156 | * @brief Get field yaw_speed from roll_pitch_yaw_speed_thrust_setpoint message |
shimniok | 0:826c6171fc1b | 157 | * |
shimniok | 0:826c6171fc1b | 158 | * @return Desired yaw angular speed in rad/s |
shimniok | 0:826c6171fc1b | 159 | */ |
shimniok | 0:826c6171fc1b | 160 | static inline float mavlink_msg_roll_pitch_yaw_speed_thrust_setpoint_get_yaw_speed(const mavlink_message_t* msg) |
shimniok | 0:826c6171fc1b | 161 | { |
shimniok | 0:826c6171fc1b | 162 | generic_32bit r; |
shimniok | 0:826c6171fc1b | 163 | r.b[3] = (msg->payload+sizeof(uint64_t)+sizeof(float)+sizeof(float))[0]; |
shimniok | 0:826c6171fc1b | 164 | r.b[2] = (msg->payload+sizeof(uint64_t)+sizeof(float)+sizeof(float))[1]; |
shimniok | 0:826c6171fc1b | 165 | r.b[1] = (msg->payload+sizeof(uint64_t)+sizeof(float)+sizeof(float))[2]; |
shimniok | 0:826c6171fc1b | 166 | r.b[0] = (msg->payload+sizeof(uint64_t)+sizeof(float)+sizeof(float))[3]; |
shimniok | 0:826c6171fc1b | 167 | return (float)r.f; |
shimniok | 0:826c6171fc1b | 168 | } |
shimniok | 0:826c6171fc1b | 169 | |
shimniok | 0:826c6171fc1b | 170 | /** |
shimniok | 0:826c6171fc1b | 171 | * @brief Get field thrust from roll_pitch_yaw_speed_thrust_setpoint message |
shimniok | 0:826c6171fc1b | 172 | * |
shimniok | 0:826c6171fc1b | 173 | * @return Collective thrust, normalized to 0 .. 1 |
shimniok | 0:826c6171fc1b | 174 | */ |
shimniok | 0:826c6171fc1b | 175 | static inline float mavlink_msg_roll_pitch_yaw_speed_thrust_setpoint_get_thrust(const mavlink_message_t* msg) |
shimniok | 0:826c6171fc1b | 176 | { |
shimniok | 0:826c6171fc1b | 177 | generic_32bit r; |
shimniok | 0:826c6171fc1b | 178 | r.b[3] = (msg->payload+sizeof(uint64_t)+sizeof(float)+sizeof(float)+sizeof(float))[0]; |
shimniok | 0:826c6171fc1b | 179 | r.b[2] = (msg->payload+sizeof(uint64_t)+sizeof(float)+sizeof(float)+sizeof(float))[1]; |
shimniok | 0:826c6171fc1b | 180 | r.b[1] = (msg->payload+sizeof(uint64_t)+sizeof(float)+sizeof(float)+sizeof(float))[2]; |
shimniok | 0:826c6171fc1b | 181 | r.b[0] = (msg->payload+sizeof(uint64_t)+sizeof(float)+sizeof(float)+sizeof(float))[3]; |
shimniok | 0:826c6171fc1b | 182 | return (float)r.f; |
shimniok | 0:826c6171fc1b | 183 | } |
shimniok | 0:826c6171fc1b | 184 | |
shimniok | 0:826c6171fc1b | 185 | /** |
shimniok | 0:826c6171fc1b | 186 | * @brief Decode a roll_pitch_yaw_speed_thrust_setpoint message into a struct |
shimniok | 0:826c6171fc1b | 187 | * |
shimniok | 0:826c6171fc1b | 188 | * @param msg The message to decode |
shimniok | 0:826c6171fc1b | 189 | * @param roll_pitch_yaw_speed_thrust_setpoint C-struct to decode the message contents into |
shimniok | 0:826c6171fc1b | 190 | */ |
shimniok | 0:826c6171fc1b | 191 | static inline void mavlink_msg_roll_pitch_yaw_speed_thrust_setpoint_decode(const mavlink_message_t* msg, mavlink_roll_pitch_yaw_speed_thrust_setpoint_t* roll_pitch_yaw_speed_thrust_setpoint) |
shimniok | 0:826c6171fc1b | 192 | { |
shimniok | 0:826c6171fc1b | 193 | roll_pitch_yaw_speed_thrust_setpoint->time_us = mavlink_msg_roll_pitch_yaw_speed_thrust_setpoint_get_time_us(msg); |
shimniok | 0:826c6171fc1b | 194 | roll_pitch_yaw_speed_thrust_setpoint->roll_speed = mavlink_msg_roll_pitch_yaw_speed_thrust_setpoint_get_roll_speed(msg); |
shimniok | 0:826c6171fc1b | 195 | roll_pitch_yaw_speed_thrust_setpoint->pitch_speed = mavlink_msg_roll_pitch_yaw_speed_thrust_setpoint_get_pitch_speed(msg); |
shimniok | 0:826c6171fc1b | 196 | roll_pitch_yaw_speed_thrust_setpoint->yaw_speed = mavlink_msg_roll_pitch_yaw_speed_thrust_setpoint_get_yaw_speed(msg); |
shimniok | 0:826c6171fc1b | 197 | roll_pitch_yaw_speed_thrust_setpoint->thrust = mavlink_msg_roll_pitch_yaw_speed_thrust_setpoint_get_thrust(msg); |
shimniok | 0:826c6171fc1b | 198 | } |