source: flair-src/branches/mavlink/tools/Controller/Mavlink/src/include/common/mavlink_msg_hil_state.h @ 75

Last change on this file since 75 was 75, checked in by Thomas Fuhrmann, 5 years ago

Change the version of mavlink generated messages and rename it to include

File size: 22.5 KB
Line 
1// MESSAGE HIL_STATE PACKING
2
3#define MAVLINK_MSG_ID_HIL_STATE 90
4
5typedef struct MAVLINK_PACKED __mavlink_hil_state_t
6{
7 uint64_t time_usec; /*< Timestamp (microseconds since UNIX epoch or microseconds since system boot)*/
8 float roll; /*< Roll angle (rad)*/
9 float pitch; /*< Pitch angle (rad)*/
10 float yaw; /*< Yaw angle (rad)*/
11 float rollspeed; /*< Body frame roll / phi angular speed (rad/s)*/
12 float pitchspeed; /*< Body frame pitch / theta angular speed (rad/s)*/
13 float yawspeed; /*< Body frame yaw / psi angular speed (rad/s)*/
14 int32_t lat; /*< Latitude, expressed as * 1E7*/
15 int32_t lon; /*< Longitude, expressed as * 1E7*/
16 int32_t alt; /*< Altitude in meters, expressed as * 1000 (millimeters)*/
17 int16_t vx; /*< Ground X Speed (Latitude), expressed as m/s * 100*/
18 int16_t vy; /*< Ground Y Speed (Longitude), expressed as m/s * 100*/
19 int16_t vz; /*< Ground Z Speed (Altitude), expressed as m/s * 100*/
20 int16_t xacc; /*< X acceleration (mg)*/
21 int16_t yacc; /*< Y acceleration (mg)*/
22 int16_t zacc; /*< Z acceleration (mg)*/
23} mavlink_hil_state_t;
24
25#define MAVLINK_MSG_ID_HIL_STATE_LEN 56
26#define MAVLINK_MSG_ID_HIL_STATE_MIN_LEN 56
27#define MAVLINK_MSG_ID_90_LEN 56
28#define MAVLINK_MSG_ID_90_MIN_LEN 56
29
30#define MAVLINK_MSG_ID_HIL_STATE_CRC 183
31#define MAVLINK_MSG_ID_90_CRC 183
32
33
34
35#if MAVLINK_COMMAND_24BIT
36#define MAVLINK_MESSAGE_INFO_HIL_STATE { \
37        90, \
38        "HIL_STATE", \
39        16, \
40        {  { "time_usec", NULL, MAVLINK_TYPE_UINT64_T, 0, 0, offsetof(mavlink_hil_state_t, time_usec) }, \
41         { "roll", NULL, MAVLINK_TYPE_FLOAT, 0, 8, offsetof(mavlink_hil_state_t, roll) }, \
42         { "pitch", NULL, MAVLINK_TYPE_FLOAT, 0, 12, offsetof(mavlink_hil_state_t, pitch) }, \
43         { "yaw", NULL, MAVLINK_TYPE_FLOAT, 0, 16, offsetof(mavlink_hil_state_t, yaw) }, \
44         { "rollspeed", NULL, MAVLINK_TYPE_FLOAT, 0, 20, offsetof(mavlink_hil_state_t, rollspeed) }, \
45         { "pitchspeed", NULL, MAVLINK_TYPE_FLOAT, 0, 24, offsetof(mavlink_hil_state_t, pitchspeed) }, \
46         { "yawspeed", NULL, MAVLINK_TYPE_FLOAT, 0, 28, offsetof(mavlink_hil_state_t, yawspeed) }, \
47         { "lat", NULL, MAVLINK_TYPE_INT32_T, 0, 32, offsetof(mavlink_hil_state_t, lat) }, \
48         { "lon", NULL, MAVLINK_TYPE_INT32_T, 0, 36, offsetof(mavlink_hil_state_t, lon) }, \
49         { "alt", NULL, MAVLINK_TYPE_INT32_T, 0, 40, offsetof(mavlink_hil_state_t, alt) }, \
50         { "vx", NULL, MAVLINK_TYPE_INT16_T, 0, 44, offsetof(mavlink_hil_state_t, vx) }, \
51         { "vy", NULL, MAVLINK_TYPE_INT16_T, 0, 46, offsetof(mavlink_hil_state_t, vy) }, \
52         { "vz", NULL, MAVLINK_TYPE_INT16_T, 0, 48, offsetof(mavlink_hil_state_t, vz) }, \
53         { "xacc", NULL, MAVLINK_TYPE_INT16_T, 0, 50, offsetof(mavlink_hil_state_t, xacc) }, \
54         { "yacc", NULL, MAVLINK_TYPE_INT16_T, 0, 52, offsetof(mavlink_hil_state_t, yacc) }, \
55         { "zacc", NULL, MAVLINK_TYPE_INT16_T, 0, 54, offsetof(mavlink_hil_state_t, zacc) }, \
56         } \
57}
58#else
59#define MAVLINK_MESSAGE_INFO_HIL_STATE { \
60        "HIL_STATE", \
61        16, \
62        {  { "time_usec", NULL, MAVLINK_TYPE_UINT64_T, 0, 0, offsetof(mavlink_hil_state_t, time_usec) }, \
63         { "roll", NULL, MAVLINK_TYPE_FLOAT, 0, 8, offsetof(mavlink_hil_state_t, roll) }, \
64         { "pitch", NULL, MAVLINK_TYPE_FLOAT, 0, 12, offsetof(mavlink_hil_state_t, pitch) }, \
65         { "yaw", NULL, MAVLINK_TYPE_FLOAT, 0, 16, offsetof(mavlink_hil_state_t, yaw) }, \
66         { "rollspeed", NULL, MAVLINK_TYPE_FLOAT, 0, 20, offsetof(mavlink_hil_state_t, rollspeed) }, \
67         { "pitchspeed", NULL, MAVLINK_TYPE_FLOAT, 0, 24, offsetof(mavlink_hil_state_t, pitchspeed) }, \
68         { "yawspeed", NULL, MAVLINK_TYPE_FLOAT, 0, 28, offsetof(mavlink_hil_state_t, yawspeed) }, \
69         { "lat", NULL, MAVLINK_TYPE_INT32_T, 0, 32, offsetof(mavlink_hil_state_t, lat) }, \
70         { "lon", NULL, MAVLINK_TYPE_INT32_T, 0, 36, offsetof(mavlink_hil_state_t, lon) }, \
71         { "alt", NULL, MAVLINK_TYPE_INT32_T, 0, 40, offsetof(mavlink_hil_state_t, alt) }, \
72         { "vx", NULL, MAVLINK_TYPE_INT16_T, 0, 44, offsetof(mavlink_hil_state_t, vx) }, \
73         { "vy", NULL, MAVLINK_TYPE_INT16_T, 0, 46, offsetof(mavlink_hil_state_t, vy) }, \
74         { "vz", NULL, MAVLINK_TYPE_INT16_T, 0, 48, offsetof(mavlink_hil_state_t, vz) }, \
75         { "xacc", NULL, MAVLINK_TYPE_INT16_T, 0, 50, offsetof(mavlink_hil_state_t, xacc) }, \
76         { "yacc", NULL, MAVLINK_TYPE_INT16_T, 0, 52, offsetof(mavlink_hil_state_t, yacc) }, \
77         { "zacc", NULL, MAVLINK_TYPE_INT16_T, 0, 54, offsetof(mavlink_hil_state_t, zacc) }, \
78         } \
79}
80#endif
81
82/**
83 * @brief Pack a hil_state message
84 * @param system_id ID of this system
85 * @param component_id ID of this component (e.g. 200 for IMU)
86 * @param msg The MAVLink message to compress the data into
87 *
88 * @param time_usec Timestamp (microseconds since UNIX epoch or microseconds since system boot)
89 * @param roll Roll angle (rad)
90 * @param pitch Pitch angle (rad)
91 * @param yaw Yaw angle (rad)
92 * @param rollspeed Body frame roll / phi angular speed (rad/s)
93 * @param pitchspeed Body frame pitch / theta angular speed (rad/s)
94 * @param yawspeed Body frame yaw / psi angular speed (rad/s)
95 * @param lat Latitude, expressed as * 1E7
96 * @param lon Longitude, expressed as * 1E7
97 * @param alt Altitude in meters, expressed as * 1000 (millimeters)
98 * @param vx Ground X Speed (Latitude), expressed as m/s * 100
99 * @param vy Ground Y Speed (Longitude), expressed as m/s * 100
100 * @param vz Ground Z Speed (Altitude), expressed as m/s * 100
101 * @param xacc X acceleration (mg)
102 * @param yacc Y acceleration (mg)
103 * @param zacc Z acceleration (mg)
104 * @return length of the message in bytes (excluding serial stream start sign)
105 */
106static inline uint16_t mavlink_msg_hil_state_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg,
107                                                       uint64_t time_usec, float roll, float pitch, float yaw, float rollspeed, float pitchspeed, float yawspeed, int32_t lat, int32_t lon, int32_t alt, int16_t vx, int16_t vy, int16_t vz, int16_t xacc, int16_t yacc, int16_t zacc)
108{
109#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
110        char buf[MAVLINK_MSG_ID_HIL_STATE_LEN];
111        _mav_put_uint64_t(buf, 0, time_usec);
112        _mav_put_float(buf, 8, roll);
113        _mav_put_float(buf, 12, pitch);
114        _mav_put_float(buf, 16, yaw);
115        _mav_put_float(buf, 20, rollspeed);
116        _mav_put_float(buf, 24, pitchspeed);
117        _mav_put_float(buf, 28, yawspeed);
118        _mav_put_int32_t(buf, 32, lat);
119        _mav_put_int32_t(buf, 36, lon);
120        _mav_put_int32_t(buf, 40, alt);
121        _mav_put_int16_t(buf, 44, vx);
122        _mav_put_int16_t(buf, 46, vy);
123        _mav_put_int16_t(buf, 48, vz);
124        _mav_put_int16_t(buf, 50, xacc);
125        _mav_put_int16_t(buf, 52, yacc);
126        _mav_put_int16_t(buf, 54, zacc);
127
128        memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_HIL_STATE_LEN);
129#else
130        mavlink_hil_state_t packet;
131        packet.time_usec = time_usec;
132        packet.roll = roll;
133        packet.pitch = pitch;
134        packet.yaw = yaw;
135        packet.rollspeed = rollspeed;
136        packet.pitchspeed = pitchspeed;
137        packet.yawspeed = yawspeed;
138        packet.lat = lat;
139        packet.lon = lon;
140        packet.alt = alt;
141        packet.vx = vx;
142        packet.vy = vy;
143        packet.vz = vz;
144        packet.xacc = xacc;
145        packet.yacc = yacc;
146        packet.zacc = zacc;
147
148        memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_HIL_STATE_LEN);
149#endif
150
151        msg->msgid = MAVLINK_MSG_ID_HIL_STATE;
152    return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_HIL_STATE_MIN_LEN, MAVLINK_MSG_ID_HIL_STATE_LEN, MAVLINK_MSG_ID_HIL_STATE_CRC);
153}
154
155/**
156 * @brief Pack a hil_state message on a channel
157 * @param system_id ID of this system
158 * @param component_id ID of this component (e.g. 200 for IMU)
159 * @param chan The MAVLink channel this message will be sent over
160 * @param msg The MAVLink message to compress the data into
161 * @param time_usec Timestamp (microseconds since UNIX epoch or microseconds since system boot)
162 * @param roll Roll angle (rad)
163 * @param pitch Pitch angle (rad)
164 * @param yaw Yaw angle (rad)
165 * @param rollspeed Body frame roll / phi angular speed (rad/s)
166 * @param pitchspeed Body frame pitch / theta angular speed (rad/s)
167 * @param yawspeed Body frame yaw / psi angular speed (rad/s)
168 * @param lat Latitude, expressed as * 1E7
169 * @param lon Longitude, expressed as * 1E7
170 * @param alt Altitude in meters, expressed as * 1000 (millimeters)
171 * @param vx Ground X Speed (Latitude), expressed as m/s * 100
172 * @param vy Ground Y Speed (Longitude), expressed as m/s * 100
173 * @param vz Ground Z Speed (Altitude), expressed as m/s * 100
174 * @param xacc X acceleration (mg)
175 * @param yacc Y acceleration (mg)
176 * @param zacc Z acceleration (mg)
177 * @return length of the message in bytes (excluding serial stream start sign)
178 */
179static inline uint16_t mavlink_msg_hil_state_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan,
180                                                           mavlink_message_t* msg,
181                                                           uint64_t time_usec,float roll,float pitch,float yaw,float rollspeed,float pitchspeed,float yawspeed,int32_t lat,int32_t lon,int32_t alt,int16_t vx,int16_t vy,int16_t vz,int16_t xacc,int16_t yacc,int16_t zacc)
182{
183#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
184        char buf[MAVLINK_MSG_ID_HIL_STATE_LEN];
185        _mav_put_uint64_t(buf, 0, time_usec);
186        _mav_put_float(buf, 8, roll);
187        _mav_put_float(buf, 12, pitch);
188        _mav_put_float(buf, 16, yaw);
189        _mav_put_float(buf, 20, rollspeed);
190        _mav_put_float(buf, 24, pitchspeed);
191        _mav_put_float(buf, 28, yawspeed);
192        _mav_put_int32_t(buf, 32, lat);
193        _mav_put_int32_t(buf, 36, lon);
194        _mav_put_int32_t(buf, 40, alt);
195        _mav_put_int16_t(buf, 44, vx);
196        _mav_put_int16_t(buf, 46, vy);
197        _mav_put_int16_t(buf, 48, vz);
198        _mav_put_int16_t(buf, 50, xacc);
199        _mav_put_int16_t(buf, 52, yacc);
200        _mav_put_int16_t(buf, 54, zacc);
201
202        memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_HIL_STATE_LEN);
203#else
204        mavlink_hil_state_t packet;
205        packet.time_usec = time_usec;
206        packet.roll = roll;
207        packet.pitch = pitch;
208        packet.yaw = yaw;
209        packet.rollspeed = rollspeed;
210        packet.pitchspeed = pitchspeed;
211        packet.yawspeed = yawspeed;
212        packet.lat = lat;
213        packet.lon = lon;
214        packet.alt = alt;
215        packet.vx = vx;
216        packet.vy = vy;
217        packet.vz = vz;
218        packet.xacc = xacc;
219        packet.yacc = yacc;
220        packet.zacc = zacc;
221
222        memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_HIL_STATE_LEN);
223#endif
224
225        msg->msgid = MAVLINK_MSG_ID_HIL_STATE;
226    return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_HIL_STATE_MIN_LEN, MAVLINK_MSG_ID_HIL_STATE_LEN, MAVLINK_MSG_ID_HIL_STATE_CRC);
227}
228
229/**
230 * @brief Encode a hil_state struct
231 *
232 * @param system_id ID of this system
233 * @param component_id ID of this component (e.g. 200 for IMU)
234 * @param msg The MAVLink message to compress the data into
235 * @param hil_state C-struct to read the message contents from
236 */
237static inline uint16_t mavlink_msg_hil_state_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_hil_state_t* hil_state)
238{
239        return mavlink_msg_hil_state_pack(system_id, component_id, msg, hil_state->time_usec, hil_state->roll, hil_state->pitch, hil_state->yaw, hil_state->rollspeed, hil_state->pitchspeed, hil_state->yawspeed, hil_state->lat, hil_state->lon, hil_state->alt, hil_state->vx, hil_state->vy, hil_state->vz, hil_state->xacc, hil_state->yacc, hil_state->zacc);
240}
241
242/**
243 * @brief Encode a hil_state struct on a channel
244 *
245 * @param system_id ID of this system
246 * @param component_id ID of this component (e.g. 200 for IMU)
247 * @param chan The MAVLink channel this message will be sent over
248 * @param msg The MAVLink message to compress the data into
249 * @param hil_state C-struct to read the message contents from
250 */
251static inline uint16_t mavlink_msg_hil_state_encode_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, const mavlink_hil_state_t* hil_state)
252{
253        return mavlink_msg_hil_state_pack_chan(system_id, component_id, chan, msg, hil_state->time_usec, hil_state->roll, hil_state->pitch, hil_state->yaw, hil_state->rollspeed, hil_state->pitchspeed, hil_state->yawspeed, hil_state->lat, hil_state->lon, hil_state->alt, hil_state->vx, hil_state->vy, hil_state->vz, hil_state->xacc, hil_state->yacc, hil_state->zacc);
254}
255
256/**
257 * @brief Send a hil_state message
258 * @param chan MAVLink channel to send the message
259 *
260 * @param time_usec Timestamp (microseconds since UNIX epoch or microseconds since system boot)
261 * @param roll Roll angle (rad)
262 * @param pitch Pitch angle (rad)
263 * @param yaw Yaw angle (rad)
264 * @param rollspeed Body frame roll / phi angular speed (rad/s)
265 * @param pitchspeed Body frame pitch / theta angular speed (rad/s)
266 * @param yawspeed Body frame yaw / psi angular speed (rad/s)
267 * @param lat Latitude, expressed as * 1E7
268 * @param lon Longitude, expressed as * 1E7
269 * @param alt Altitude in meters, expressed as * 1000 (millimeters)
270 * @param vx Ground X Speed (Latitude), expressed as m/s * 100
271 * @param vy Ground Y Speed (Longitude), expressed as m/s * 100
272 * @param vz Ground Z Speed (Altitude), expressed as m/s * 100
273 * @param xacc X acceleration (mg)
274 * @param yacc Y acceleration (mg)
275 * @param zacc Z acceleration (mg)
276 */
277#ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS
278
279static inline void mavlink_msg_hil_state_send(mavlink_channel_t chan, uint64_t time_usec, float roll, float pitch, float yaw, float rollspeed, float pitchspeed, float yawspeed, int32_t lat, int32_t lon, int32_t alt, int16_t vx, int16_t vy, int16_t vz, int16_t xacc, int16_t yacc, int16_t zacc)
280{
281#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
282        char buf[MAVLINK_MSG_ID_HIL_STATE_LEN];
283        _mav_put_uint64_t(buf, 0, time_usec);
284        _mav_put_float(buf, 8, roll);
285        _mav_put_float(buf, 12, pitch);
286        _mav_put_float(buf, 16, yaw);
287        _mav_put_float(buf, 20, rollspeed);
288        _mav_put_float(buf, 24, pitchspeed);
289        _mav_put_float(buf, 28, yawspeed);
290        _mav_put_int32_t(buf, 32, lat);
291        _mav_put_int32_t(buf, 36, lon);
292        _mav_put_int32_t(buf, 40, alt);
293        _mav_put_int16_t(buf, 44, vx);
294        _mav_put_int16_t(buf, 46, vy);
295        _mav_put_int16_t(buf, 48, vz);
296        _mav_put_int16_t(buf, 50, xacc);
297        _mav_put_int16_t(buf, 52, yacc);
298        _mav_put_int16_t(buf, 54, zacc);
299
300    _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_HIL_STATE, buf, MAVLINK_MSG_ID_HIL_STATE_MIN_LEN, MAVLINK_MSG_ID_HIL_STATE_LEN, MAVLINK_MSG_ID_HIL_STATE_CRC);
301#else
302        mavlink_hil_state_t packet;
303        packet.time_usec = time_usec;
304        packet.roll = roll;
305        packet.pitch = pitch;
306        packet.yaw = yaw;
307        packet.rollspeed = rollspeed;
308        packet.pitchspeed = pitchspeed;
309        packet.yawspeed = yawspeed;
310        packet.lat = lat;
311        packet.lon = lon;
312        packet.alt = alt;
313        packet.vx = vx;
314        packet.vy = vy;
315        packet.vz = vz;
316        packet.xacc = xacc;
317        packet.yacc = yacc;
318        packet.zacc = zacc;
319
320    _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_HIL_STATE, (const char *)&packet, MAVLINK_MSG_ID_HIL_STATE_MIN_LEN, MAVLINK_MSG_ID_HIL_STATE_LEN, MAVLINK_MSG_ID_HIL_STATE_CRC);
321#endif
322}
323
324/**
325 * @brief Send a hil_state message
326 * @param chan MAVLink channel to send the message
327 * @param struct The MAVLink struct to serialize
328 */
329static inline void mavlink_msg_hil_state_send_struct(mavlink_channel_t chan, const mavlink_hil_state_t* hil_state)
330{
331#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
332    mavlink_msg_hil_state_send(chan, hil_state->time_usec, hil_state->roll, hil_state->pitch, hil_state->yaw, hil_state->rollspeed, hil_state->pitchspeed, hil_state->yawspeed, hil_state->lat, hil_state->lon, hil_state->alt, hil_state->vx, hil_state->vy, hil_state->vz, hil_state->xacc, hil_state->yacc, hil_state->zacc);
333#else
334    _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_HIL_STATE, (const char *)hil_state, MAVLINK_MSG_ID_HIL_STATE_MIN_LEN, MAVLINK_MSG_ID_HIL_STATE_LEN, MAVLINK_MSG_ID_HIL_STATE_CRC);
335#endif
336}
337
338#if MAVLINK_MSG_ID_HIL_STATE_LEN <= MAVLINK_MAX_PAYLOAD_LEN
339/*
340  This varient of _send() can be used to save stack space by re-using
341  memory from the receive buffer.  The caller provides a
342  mavlink_message_t which is the size of a full mavlink message. This
343  is usually the receive buffer for the channel, and allows a reply to an
344  incoming message with minimum stack space usage.
345 */
346static inline void mavlink_msg_hil_state_send_buf(mavlink_message_t *msgbuf, mavlink_channel_t chan,  uint64_t time_usec, float roll, float pitch, float yaw, float rollspeed, float pitchspeed, float yawspeed, int32_t lat, int32_t lon, int32_t alt, int16_t vx, int16_t vy, int16_t vz, int16_t xacc, int16_t yacc, int16_t zacc)
347{
348#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
349        char *buf = (char *)msgbuf;
350        _mav_put_uint64_t(buf, 0, time_usec);
351        _mav_put_float(buf, 8, roll);
352        _mav_put_float(buf, 12, pitch);
353        _mav_put_float(buf, 16, yaw);
354        _mav_put_float(buf, 20, rollspeed);
355        _mav_put_float(buf, 24, pitchspeed);
356        _mav_put_float(buf, 28, yawspeed);
357        _mav_put_int32_t(buf, 32, lat);
358        _mav_put_int32_t(buf, 36, lon);
359        _mav_put_int32_t(buf, 40, alt);
360        _mav_put_int16_t(buf, 44, vx);
361        _mav_put_int16_t(buf, 46, vy);
362        _mav_put_int16_t(buf, 48, vz);
363        _mav_put_int16_t(buf, 50, xacc);
364        _mav_put_int16_t(buf, 52, yacc);
365        _mav_put_int16_t(buf, 54, zacc);
366
367    _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_HIL_STATE, buf, MAVLINK_MSG_ID_HIL_STATE_MIN_LEN, MAVLINK_MSG_ID_HIL_STATE_LEN, MAVLINK_MSG_ID_HIL_STATE_CRC);
368#else
369        mavlink_hil_state_t *packet = (mavlink_hil_state_t *)msgbuf;
370        packet->time_usec = time_usec;
371        packet->roll = roll;
372        packet->pitch = pitch;
373        packet->yaw = yaw;
374        packet->rollspeed = rollspeed;
375        packet->pitchspeed = pitchspeed;
376        packet->yawspeed = yawspeed;
377        packet->lat = lat;
378        packet->lon = lon;
379        packet->alt = alt;
380        packet->vx = vx;
381        packet->vy = vy;
382        packet->vz = vz;
383        packet->xacc = xacc;
384        packet->yacc = yacc;
385        packet->zacc = zacc;
386
387    _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_HIL_STATE, (const char *)packet, MAVLINK_MSG_ID_HIL_STATE_MIN_LEN, MAVLINK_MSG_ID_HIL_STATE_LEN, MAVLINK_MSG_ID_HIL_STATE_CRC);
388#endif
389}
390#endif
391
392#endif
393
394// MESSAGE HIL_STATE UNPACKING
395
396
397/**
398 * @brief Get field time_usec from hil_state message
399 *
400 * @return Timestamp (microseconds since UNIX epoch or microseconds since system boot)
401 */
402static inline uint64_t mavlink_msg_hil_state_get_time_usec(const mavlink_message_t* msg)
403{
404        return _MAV_RETURN_uint64_t(msg,  0);
405}
406
407/**
408 * @brief Get field roll from hil_state message
409 *
410 * @return Roll angle (rad)
411 */
412static inline float mavlink_msg_hil_state_get_roll(const mavlink_message_t* msg)
413{
414        return _MAV_RETURN_float(msg,  8);
415}
416
417/**
418 * @brief Get field pitch from hil_state message
419 *
420 * @return Pitch angle (rad)
421 */
422static inline float mavlink_msg_hil_state_get_pitch(const mavlink_message_t* msg)
423{
424        return _MAV_RETURN_float(msg,  12);
425}
426
427/**
428 * @brief Get field yaw from hil_state message
429 *
430 * @return Yaw angle (rad)
431 */
432static inline float mavlink_msg_hil_state_get_yaw(const mavlink_message_t* msg)
433{
434        return _MAV_RETURN_float(msg,  16);
435}
436
437/**
438 * @brief Get field rollspeed from hil_state message
439 *
440 * @return Body frame roll / phi angular speed (rad/s)
441 */
442static inline float mavlink_msg_hil_state_get_rollspeed(const mavlink_message_t* msg)
443{
444        return _MAV_RETURN_float(msg,  20);
445}
446
447/**
448 * @brief Get field pitchspeed from hil_state message
449 *
450 * @return Body frame pitch / theta angular speed (rad/s)
451 */
452static inline float mavlink_msg_hil_state_get_pitchspeed(const mavlink_message_t* msg)
453{
454        return _MAV_RETURN_float(msg,  24);
455}
456
457/**
458 * @brief Get field yawspeed from hil_state message
459 *
460 * @return Body frame yaw / psi angular speed (rad/s)
461 */
462static inline float mavlink_msg_hil_state_get_yawspeed(const mavlink_message_t* msg)
463{
464        return _MAV_RETURN_float(msg,  28);
465}
466
467/**
468 * @brief Get field lat from hil_state message
469 *
470 * @return Latitude, expressed as * 1E7
471 */
472static inline int32_t mavlink_msg_hil_state_get_lat(const mavlink_message_t* msg)
473{
474        return _MAV_RETURN_int32_t(msg,  32);
475}
476
477/**
478 * @brief Get field lon from hil_state message
479 *
480 * @return Longitude, expressed as * 1E7
481 */
482static inline int32_t mavlink_msg_hil_state_get_lon(const mavlink_message_t* msg)
483{
484        return _MAV_RETURN_int32_t(msg,  36);
485}
486
487/**
488 * @brief Get field alt from hil_state message
489 *
490 * @return Altitude in meters, expressed as * 1000 (millimeters)
491 */
492static inline int32_t mavlink_msg_hil_state_get_alt(const mavlink_message_t* msg)
493{
494        return _MAV_RETURN_int32_t(msg,  40);
495}
496
497/**
498 * @brief Get field vx from hil_state message
499 *
500 * @return Ground X Speed (Latitude), expressed as m/s * 100
501 */
502static inline int16_t mavlink_msg_hil_state_get_vx(const mavlink_message_t* msg)
503{
504        return _MAV_RETURN_int16_t(msg,  44);
505}
506
507/**
508 * @brief Get field vy from hil_state message
509 *
510 * @return Ground Y Speed (Longitude), expressed as m/s * 100
511 */
512static inline int16_t mavlink_msg_hil_state_get_vy(const mavlink_message_t* msg)
513{
514        return _MAV_RETURN_int16_t(msg,  46);
515}
516
517/**
518 * @brief Get field vz from hil_state message
519 *
520 * @return Ground Z Speed (Altitude), expressed as m/s * 100
521 */
522static inline int16_t mavlink_msg_hil_state_get_vz(const mavlink_message_t* msg)
523{
524        return _MAV_RETURN_int16_t(msg,  48);
525}
526
527/**
528 * @brief Get field xacc from hil_state message
529 *
530 * @return X acceleration (mg)
531 */
532static inline int16_t mavlink_msg_hil_state_get_xacc(const mavlink_message_t* msg)
533{
534        return _MAV_RETURN_int16_t(msg,  50);
535}
536
537/**
538 * @brief Get field yacc from hil_state message
539 *
540 * @return Y acceleration (mg)
541 */
542static inline int16_t mavlink_msg_hil_state_get_yacc(const mavlink_message_t* msg)
543{
544        return _MAV_RETURN_int16_t(msg,  52);
545}
546
547/**
548 * @brief Get field zacc from hil_state message
549 *
550 * @return Z acceleration (mg)
551 */
552static inline int16_t mavlink_msg_hil_state_get_zacc(const mavlink_message_t* msg)
553{
554        return _MAV_RETURN_int16_t(msg,  54);
555}
556
557/**
558 * @brief Decode a hil_state message into a struct
559 *
560 * @param msg The message to decode
561 * @param hil_state C-struct to decode the message contents into
562 */
563static inline void mavlink_msg_hil_state_decode(const mavlink_message_t* msg, mavlink_hil_state_t* hil_state)
564{
565#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
566        hil_state->time_usec = mavlink_msg_hil_state_get_time_usec(msg);
567        hil_state->roll = mavlink_msg_hil_state_get_roll(msg);
568        hil_state->pitch = mavlink_msg_hil_state_get_pitch(msg);
569        hil_state->yaw = mavlink_msg_hil_state_get_yaw(msg);
570        hil_state->rollspeed = mavlink_msg_hil_state_get_rollspeed(msg);
571        hil_state->pitchspeed = mavlink_msg_hil_state_get_pitchspeed(msg);
572        hil_state->yawspeed = mavlink_msg_hil_state_get_yawspeed(msg);
573        hil_state->lat = mavlink_msg_hil_state_get_lat(msg);
574        hil_state->lon = mavlink_msg_hil_state_get_lon(msg);
575        hil_state->alt = mavlink_msg_hil_state_get_alt(msg);
576        hil_state->vx = mavlink_msg_hil_state_get_vx(msg);
577        hil_state->vy = mavlink_msg_hil_state_get_vy(msg);
578        hil_state->vz = mavlink_msg_hil_state_get_vz(msg);
579        hil_state->xacc = mavlink_msg_hil_state_get_xacc(msg);
580        hil_state->yacc = mavlink_msg_hil_state_get_yacc(msg);
581        hil_state->zacc = mavlink_msg_hil_state_get_zacc(msg);
582#else
583        uint8_t len = msg->len < MAVLINK_MSG_ID_HIL_STATE_LEN? msg->len : MAVLINK_MSG_ID_HIL_STATE_LEN;
584        memset(hil_state, 0, MAVLINK_MSG_ID_HIL_STATE_LEN);
585        memcpy(hil_state, _MAV_PAYLOAD(msg), len);
586#endif
587}
Note: See TracBrowser for help on using the repository browser.