Subversion Repositories Projects

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
1702 - 1
// MESSAGE NAV_CONTROLLER_OUTPUT PACKING
2
 
3
#define MAVLINK_MSG_ID_NAV_CONTROLLER_OUTPUT 62
4
 
5
typedef struct __mavlink_nav_controller_output_t
6
{
7
 float nav_roll; ///< Current desired roll in degrees
8
 float nav_pitch; ///< Current desired pitch in degrees
9
 int16_t nav_bearing; ///< Current desired heading in degrees
10
 int16_t target_bearing; ///< Bearing to current waypoint/target in degrees
11
 uint16_t wp_dist; ///< Distance to active waypoint in meters
12
 float alt_error; ///< Current altitude error in meters
13
 float aspd_error; ///< Current airspeed error in meters/second
14
 float xtrack_error; ///< Current crosstrack error on x-y plane in meters
15
} mavlink_nav_controller_output_t;
16
 
17
#define MAVLINK_MSG_ID_NAV_CONTROLLER_OUTPUT_LEN 26
18
#define MAVLINK_MSG_ID_62_LEN 26
19
 
20
 
21
 
22
#define MAVLINK_MESSAGE_INFO_NAV_CONTROLLER_OUTPUT { \
23
        "NAV_CONTROLLER_OUTPUT", \
24
        8, \
25
        {  { "nav_roll", NULL, MAVLINK_TYPE_FLOAT, 0, 0, offsetof(mavlink_nav_controller_output_t, nav_roll) }, \
26
         { "nav_pitch", NULL, MAVLINK_TYPE_FLOAT, 0, 4, offsetof(mavlink_nav_controller_output_t, nav_pitch) }, \
27
         { "nav_bearing", NULL, MAVLINK_TYPE_INT16_T, 0, 8, offsetof(mavlink_nav_controller_output_t, nav_bearing) }, \
28
         { "target_bearing", NULL, MAVLINK_TYPE_INT16_T, 0, 10, offsetof(mavlink_nav_controller_output_t, target_bearing) }, \
29
         { "wp_dist", NULL, MAVLINK_TYPE_UINT16_T, 0, 12, offsetof(mavlink_nav_controller_output_t, wp_dist) }, \
30
         { "alt_error", NULL, MAVLINK_TYPE_FLOAT, 0, 14, offsetof(mavlink_nav_controller_output_t, alt_error) }, \
31
         { "aspd_error", NULL, MAVLINK_TYPE_FLOAT, 0, 18, offsetof(mavlink_nav_controller_output_t, aspd_error) }, \
32
         { "xtrack_error", NULL, MAVLINK_TYPE_FLOAT, 0, 22, offsetof(mavlink_nav_controller_output_t, xtrack_error) }, \
33
         } \
34
}
35
 
36
 
37
/**
38
 * @brief Pack a nav_controller_output message
39
 * @param system_id ID of this system
40
 * @param component_id ID of this component (e.g. 200 for IMU)
41
 * @param msg The MAVLink message to compress the data into
42
 *
43
 * @param nav_roll Current desired roll in degrees
44
 * @param nav_pitch Current desired pitch in degrees
45
 * @param nav_bearing Current desired heading in degrees
46
 * @param target_bearing Bearing to current waypoint/target in degrees
47
 * @param wp_dist Distance to active waypoint in meters
48
 * @param alt_error Current altitude error in meters
49
 * @param aspd_error Current airspeed error in meters/second
50
 * @param xtrack_error Current crosstrack error on x-y plane in meters
51
 * @return length of the message in bytes (excluding serial stream start sign)
52
 */
53
static inline uint16_t mavlink_msg_nav_controller_output_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg,
54
                                                       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)
55
{
56
#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
57
        char buf[26];
58
        _mav_put_float(buf, 0, nav_roll);
59
        _mav_put_float(buf, 4, nav_pitch);
60
        _mav_put_int16_t(buf, 8, nav_bearing);
61
        _mav_put_int16_t(buf, 10, target_bearing);
62
        _mav_put_uint16_t(buf, 12, wp_dist);
63
        _mav_put_float(buf, 14, alt_error);
64
        _mav_put_float(buf, 18, aspd_error);
65
        _mav_put_float(buf, 22, xtrack_error);
66
 
67
        memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, 26);
68
#else
69
        mavlink_nav_controller_output_t packet;
70
        packet.nav_roll = nav_roll;
71
        packet.nav_pitch = nav_pitch;
72
        packet.nav_bearing = nav_bearing;
73
        packet.target_bearing = target_bearing;
74
        packet.wp_dist = wp_dist;
75
        packet.alt_error = alt_error;
76
        packet.aspd_error = aspd_error;
77
        packet.xtrack_error = xtrack_error;
78
 
79
        memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, 26);
80
#endif
81
 
82
        msg->msgid = MAVLINK_MSG_ID_NAV_CONTROLLER_OUTPUT;
83
        return mavlink_finalize_message(msg, system_id, component_id, 26);
84
}
85
 
86
/**
87
 * @brief Pack a nav_controller_output message on a channel
88
 * @param system_id ID of this system
89
 * @param component_id ID of this component (e.g. 200 for IMU)
90
 * @param chan The MAVLink channel this message was sent over
91
 * @param msg The MAVLink message to compress the data into
92
 * @param nav_roll Current desired roll in degrees
93
 * @param nav_pitch Current desired pitch in degrees
94
 * @param nav_bearing Current desired heading in degrees
95
 * @param target_bearing Bearing to current waypoint/target in degrees
96
 * @param wp_dist Distance to active waypoint in meters
97
 * @param alt_error Current altitude error in meters
98
 * @param aspd_error Current airspeed error in meters/second
99
 * @param xtrack_error Current crosstrack error on x-y plane in meters
100
 * @return length of the message in bytes (excluding serial stream start sign)
101
 */
102
static inline uint16_t mavlink_msg_nav_controller_output_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan,
103
                                                           mavlink_message_t* msg,
104
                                                           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)
105
{
106
#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
107
        char buf[26];
108
        _mav_put_float(buf, 0, nav_roll);
109
        _mav_put_float(buf, 4, nav_pitch);
110
        _mav_put_int16_t(buf, 8, nav_bearing);
111
        _mav_put_int16_t(buf, 10, target_bearing);
112
        _mav_put_uint16_t(buf, 12, wp_dist);
113
        _mav_put_float(buf, 14, alt_error);
114
        _mav_put_float(buf, 18, aspd_error);
115
        _mav_put_float(buf, 22, xtrack_error);
116
 
117
        memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, 26);
118
#else
119
        mavlink_nav_controller_output_t packet;
120
        packet.nav_roll = nav_roll;
121
        packet.nav_pitch = nav_pitch;
122
        packet.nav_bearing = nav_bearing;
123
        packet.target_bearing = target_bearing;
124
        packet.wp_dist = wp_dist;
125
        packet.alt_error = alt_error;
126
        packet.aspd_error = aspd_error;
127
        packet.xtrack_error = xtrack_error;
128
 
129
        memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, 26);
130
#endif
131
 
132
        msg->msgid = MAVLINK_MSG_ID_NAV_CONTROLLER_OUTPUT;
133
        return mavlink_finalize_message_chan(msg, system_id, component_id, chan, 26);
134
}
135
 
136
/**
137
 * @brief Encode a nav_controller_output struct into a message
138
 *
139
 * @param system_id ID of this system
140
 * @param component_id ID of this component (e.g. 200 for IMU)
141
 * @param msg The MAVLink message to compress the data into
142
 * @param nav_controller_output C-struct to read the message contents from
143
 */
144
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)
145
{
146
        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);
147
}
148
 
149
/**
150
 * @brief Send a nav_controller_output message
151
 * @param chan MAVLink channel to send the message
152
 *
153
 * @param nav_roll Current desired roll in degrees
154
 * @param nav_pitch Current desired pitch in degrees
155
 * @param nav_bearing Current desired heading in degrees
156
 * @param target_bearing Bearing to current waypoint/target in degrees
157
 * @param wp_dist Distance to active waypoint in meters
158
 * @param alt_error Current altitude error in meters
159
 * @param aspd_error Current airspeed error in meters/second
160
 * @param xtrack_error Current crosstrack error on x-y plane in meters
161
 */
162
#ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS
163
 
164
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)
165
{
166
#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
167
        char buf[26];
168
        _mav_put_float(buf, 0, nav_roll);
169
        _mav_put_float(buf, 4, nav_pitch);
170
        _mav_put_int16_t(buf, 8, nav_bearing);
171
        _mav_put_int16_t(buf, 10, target_bearing);
172
        _mav_put_uint16_t(buf, 12, wp_dist);
173
        _mav_put_float(buf, 14, alt_error);
174
        _mav_put_float(buf, 18, aspd_error);
175
        _mav_put_float(buf, 22, xtrack_error);
176
 
177
        _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_NAV_CONTROLLER_OUTPUT, buf, 26);
178
#else
179
        mavlink_nav_controller_output_t packet;
180
        packet.nav_roll = nav_roll;
181
        packet.nav_pitch = nav_pitch;
182
        packet.nav_bearing = nav_bearing;
183
        packet.target_bearing = target_bearing;
184
        packet.wp_dist = wp_dist;
185
        packet.alt_error = alt_error;
186
        packet.aspd_error = aspd_error;
187
        packet.xtrack_error = xtrack_error;
188
 
189
        _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_NAV_CONTROLLER_OUTPUT, (const char *)&packet, 26);
190
#endif
191
}
192
 
193
#endif
194
 
195
// MESSAGE NAV_CONTROLLER_OUTPUT UNPACKING
196
 
197
 
198
/**
199
 * @brief Get field nav_roll from nav_controller_output message
200
 *
201
 * @return Current desired roll in degrees
202
 */
203
static inline float mavlink_msg_nav_controller_output_get_nav_roll(const mavlink_message_t* msg)
204
{
205
        return _MAV_RETURN_float(msg,  0);
206
}
207
 
208
/**
209
 * @brief Get field nav_pitch from nav_controller_output message
210
 *
211
 * @return Current desired pitch in degrees
212
 */
213
static inline float mavlink_msg_nav_controller_output_get_nav_pitch(const mavlink_message_t* msg)
214
{
215
        return _MAV_RETURN_float(msg,  4);
216
}
217
 
218
/**
219
 * @brief Get field nav_bearing from nav_controller_output message
220
 *
221
 * @return Current desired heading in degrees
222
 */
223
static inline int16_t mavlink_msg_nav_controller_output_get_nav_bearing(const mavlink_message_t* msg)
224
{
225
        return _MAV_RETURN_int16_t(msg,  8);
226
}
227
 
228
/**
229
 * @brief Get field target_bearing from nav_controller_output message
230
 *
231
 * @return Bearing to current waypoint/target in degrees
232
 */
233
static inline int16_t mavlink_msg_nav_controller_output_get_target_bearing(const mavlink_message_t* msg)
234
{
235
        return _MAV_RETURN_int16_t(msg,  10);
236
}
237
 
238
/**
239
 * @brief Get field wp_dist from nav_controller_output message
240
 *
241
 * @return Distance to active waypoint in meters
242
 */
243
static inline uint16_t mavlink_msg_nav_controller_output_get_wp_dist(const mavlink_message_t* msg)
244
{
245
        return _MAV_RETURN_uint16_t(msg,  12);
246
}
247
 
248
/**
249
 * @brief Get field alt_error from nav_controller_output message
250
 *
251
 * @return Current altitude error in meters
252
 */
253
static inline float mavlink_msg_nav_controller_output_get_alt_error(const mavlink_message_t* msg)
254
{
255
        return _MAV_RETURN_float(msg,  14);
256
}
257
 
258
/**
259
 * @brief Get field aspd_error from nav_controller_output message
260
 *
261
 * @return Current airspeed error in meters/second
262
 */
263
static inline float mavlink_msg_nav_controller_output_get_aspd_error(const mavlink_message_t* msg)
264
{
265
        return _MAV_RETURN_float(msg,  18);
266
}
267
 
268
/**
269
 * @brief Get field xtrack_error from nav_controller_output message
270
 *
271
 * @return Current crosstrack error on x-y plane in meters
272
 */
273
static inline float mavlink_msg_nav_controller_output_get_xtrack_error(const mavlink_message_t* msg)
274
{
275
        return _MAV_RETURN_float(msg,  22);
276
}
277
 
278
/**
279
 * @brief Decode a nav_controller_output message into a struct
280
 *
281
 * @param msg The message to decode
282
 * @param nav_controller_output C-struct to decode the message contents into
283
 */
284
static inline void mavlink_msg_nav_controller_output_decode(const mavlink_message_t* msg, mavlink_nav_controller_output_t* nav_controller_output)
285
{
286
#if MAVLINK_NEED_BYTE_SWAP
287
        nav_controller_output->nav_roll = mavlink_msg_nav_controller_output_get_nav_roll(msg);
288
        nav_controller_output->nav_pitch = mavlink_msg_nav_controller_output_get_nav_pitch(msg);
289
        nav_controller_output->nav_bearing = mavlink_msg_nav_controller_output_get_nav_bearing(msg);
290
        nav_controller_output->target_bearing = mavlink_msg_nav_controller_output_get_target_bearing(msg);
291
        nav_controller_output->wp_dist = mavlink_msg_nav_controller_output_get_wp_dist(msg);
292
        nav_controller_output->alt_error = mavlink_msg_nav_controller_output_get_alt_error(msg);
293
        nav_controller_output->aspd_error = mavlink_msg_nav_controller_output_get_aspd_error(msg);
294
        nav_controller_output->xtrack_error = mavlink_msg_nav_controller_output_get_xtrack_error(msg);
295
#else
296
        memcpy(nav_controller_output, _MAV_PAYLOAD(msg), 26);
297
#endif
298
}