Subversion Repositories Projects

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
1702 - 1
// MESSAGE OBS_AIR_VELOCITY PACKING
2
 
3
#define MAVLINK_MSG_ID_OBS_AIR_VELOCITY 178
4
 
5
typedef struct __mavlink_obs_air_velocity_t
6
{
7
 float magnitude; ///< Air speed
8
 float aoa; ///< angle of attack
9
 float slip; ///< slip angle
10
} mavlink_obs_air_velocity_t;
11
 
12
#define MAVLINK_MSG_ID_OBS_AIR_VELOCITY_LEN 12
13
#define MAVLINK_MSG_ID_178_LEN 12
14
 
15
 
16
 
17
#define MAVLINK_MESSAGE_INFO_OBS_AIR_VELOCITY { \
18
        "OBS_AIR_VELOCITY", \
19
        3, \
20
        {  { "magnitude", NULL, MAVLINK_TYPE_FLOAT, 0, 0, offsetof(mavlink_obs_air_velocity_t, magnitude) }, \
21
         { "aoa", NULL, MAVLINK_TYPE_FLOAT, 0, 4, offsetof(mavlink_obs_air_velocity_t, aoa) }, \
22
         { "slip", NULL, MAVLINK_TYPE_FLOAT, 0, 8, offsetof(mavlink_obs_air_velocity_t, slip) }, \
23
         } \
24
}
25
 
26
 
27
/**
28
 * @brief Pack a obs_air_velocity message
29
 * @param system_id ID of this system
30
 * @param component_id ID of this component (e.g. 200 for IMU)
31
 * @param msg The MAVLink message to compress the data into
32
 *
33
 * @param magnitude Air speed
34
 * @param aoa angle of attack
35
 * @param slip slip angle
36
 * @return length of the message in bytes (excluding serial stream start sign)
37
 */
38
static inline uint16_t mavlink_msg_obs_air_velocity_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg,
39
                                                       float magnitude, float aoa, float slip)
40
{
41
#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
42
        char buf[12];
43
        _mav_put_float(buf, 0, magnitude);
44
        _mav_put_float(buf, 4, aoa);
45
        _mav_put_float(buf, 8, slip);
46
 
47
        memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, 12);
48
#else
49
        mavlink_obs_air_velocity_t packet;
50
        packet.magnitude = magnitude;
51
        packet.aoa = aoa;
52
        packet.slip = slip;
53
 
54
        memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, 12);
55
#endif
56
 
57
        msg->msgid = MAVLINK_MSG_ID_OBS_AIR_VELOCITY;
58
        return mavlink_finalize_message(msg, system_id, component_id, 12, 32);
59
}
60
 
61
/**
62
 * @brief Pack a obs_air_velocity message on a channel
63
 * @param system_id ID of this system
64
 * @param component_id ID of this component (e.g. 200 for IMU)
65
 * @param chan The MAVLink channel this message was sent over
66
 * @param msg The MAVLink message to compress the data into
67
 * @param magnitude Air speed
68
 * @param aoa angle of attack
69
 * @param slip slip angle
70
 * @return length of the message in bytes (excluding serial stream start sign)
71
 */
72
static inline uint16_t mavlink_msg_obs_air_velocity_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan,
73
                                                           mavlink_message_t* msg,
74
                                                           float magnitude,float aoa,float slip)
75
{
76
#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
77
        char buf[12];
78
        _mav_put_float(buf, 0, magnitude);
79
        _mav_put_float(buf, 4, aoa);
80
        _mav_put_float(buf, 8, slip);
81
 
82
        memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, 12);
83
#else
84
        mavlink_obs_air_velocity_t packet;
85
        packet.magnitude = magnitude;
86
        packet.aoa = aoa;
87
        packet.slip = slip;
88
 
89
        memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, 12);
90
#endif
91
 
92
        msg->msgid = MAVLINK_MSG_ID_OBS_AIR_VELOCITY;
93
        return mavlink_finalize_message_chan(msg, system_id, component_id, chan, 12, 32);
94
}
95
 
96
/**
97
 * @brief Encode a obs_air_velocity struct into a message
98
 *
99
 * @param system_id ID of this system
100
 * @param component_id ID of this component (e.g. 200 for IMU)
101
 * @param msg The MAVLink message to compress the data into
102
 * @param obs_air_velocity C-struct to read the message contents from
103
 */
104
static inline uint16_t mavlink_msg_obs_air_velocity_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_obs_air_velocity_t* obs_air_velocity)
105
{
106
        return mavlink_msg_obs_air_velocity_pack(system_id, component_id, msg, obs_air_velocity->magnitude, obs_air_velocity->aoa, obs_air_velocity->slip);
107
}
108
 
109
/**
110
 * @brief Send a obs_air_velocity message
111
 * @param chan MAVLink channel to send the message
112
 *
113
 * @param magnitude Air speed
114
 * @param aoa angle of attack
115
 * @param slip slip angle
116
 */
117
#ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS
118
 
119
static inline void mavlink_msg_obs_air_velocity_send(mavlink_channel_t chan, float magnitude, float aoa, float slip)
120
{
121
#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
122
        char buf[12];
123
        _mav_put_float(buf, 0, magnitude);
124
        _mav_put_float(buf, 4, aoa);
125
        _mav_put_float(buf, 8, slip);
126
 
127
        _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_OBS_AIR_VELOCITY, buf, 12, 32);
128
#else
129
        mavlink_obs_air_velocity_t packet;
130
        packet.magnitude = magnitude;
131
        packet.aoa = aoa;
132
        packet.slip = slip;
133
 
134
        _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_OBS_AIR_VELOCITY, (const char *)&packet, 12, 32);
135
#endif
136
}
137
 
138
#endif
139
 
140
// MESSAGE OBS_AIR_VELOCITY UNPACKING
141
 
142
 
143
/**
144
 * @brief Get field magnitude from obs_air_velocity message
145
 *
146
 * @return Air speed
147
 */
148
static inline float mavlink_msg_obs_air_velocity_get_magnitude(const mavlink_message_t* msg)
149
{
150
        return _MAV_RETURN_float(msg,  0);
151
}
152
 
153
/**
154
 * @brief Get field aoa from obs_air_velocity message
155
 *
156
 * @return angle of attack
157
 */
158
static inline float mavlink_msg_obs_air_velocity_get_aoa(const mavlink_message_t* msg)
159
{
160
        return _MAV_RETURN_float(msg,  4);
161
}
162
 
163
/**
164
 * @brief Get field slip from obs_air_velocity message
165
 *
166
 * @return slip angle
167
 */
168
static inline float mavlink_msg_obs_air_velocity_get_slip(const mavlink_message_t* msg)
169
{
170
        return _MAV_RETURN_float(msg,  8);
171
}
172
 
173
/**
174
 * @brief Decode a obs_air_velocity message into a struct
175
 *
176
 * @param msg The message to decode
177
 * @param obs_air_velocity C-struct to decode the message contents into
178
 */
179
static inline void mavlink_msg_obs_air_velocity_decode(const mavlink_message_t* msg, mavlink_obs_air_velocity_t* obs_air_velocity)
180
{
181
#if MAVLINK_NEED_BYTE_SWAP
182
        obs_air_velocity->magnitude = mavlink_msg_obs_air_velocity_get_magnitude(msg);
183
        obs_air_velocity->aoa = mavlink_msg_obs_air_velocity_get_aoa(msg);
184
        obs_air_velocity->slip = mavlink_msg_obs_air_velocity_get_slip(msg);
185
#else
186
        memcpy(obs_air_velocity, _MAV_PAYLOAD(msg), 12);
187
#endif
188
}