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

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

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

File size: 11.3 KB
Line 
1// MESSAGE VISION_SPEED_ESTIMATE PACKING
2
3#define MAVLINK_MSG_ID_VISION_SPEED_ESTIMATE 103
4
5typedef struct MAVLINK_PACKED __mavlink_vision_speed_estimate_t
6{
7 uint64_t usec; /*< Timestamp (microseconds, synced to UNIX time or since system boot)*/
8 float x; /*< Global X speed*/
9 float y; /*< Global Y speed*/
10 float z; /*< Global Z speed*/
11} mavlink_vision_speed_estimate_t;
12
13#define MAVLINK_MSG_ID_VISION_SPEED_ESTIMATE_LEN 20
14#define MAVLINK_MSG_ID_VISION_SPEED_ESTIMATE_MIN_LEN 20
15#define MAVLINK_MSG_ID_103_LEN 20
16#define MAVLINK_MSG_ID_103_MIN_LEN 20
17
18#define MAVLINK_MSG_ID_VISION_SPEED_ESTIMATE_CRC 208
19#define MAVLINK_MSG_ID_103_CRC 208
20
21
22
23#if MAVLINK_COMMAND_24BIT
24#define MAVLINK_MESSAGE_INFO_VISION_SPEED_ESTIMATE { \
25 103, \
26 "VISION_SPEED_ESTIMATE", \
27 4, \
28 { { "usec", NULL, MAVLINK_TYPE_UINT64_T, 0, 0, offsetof(mavlink_vision_speed_estimate_t, usec) }, \
29 { "x", NULL, MAVLINK_TYPE_FLOAT, 0, 8, offsetof(mavlink_vision_speed_estimate_t, x) }, \
30 { "y", NULL, MAVLINK_TYPE_FLOAT, 0, 12, offsetof(mavlink_vision_speed_estimate_t, y) }, \
31 { "z", NULL, MAVLINK_TYPE_FLOAT, 0, 16, offsetof(mavlink_vision_speed_estimate_t, z) }, \
32 } \
33}
34#else
35#define MAVLINK_MESSAGE_INFO_VISION_SPEED_ESTIMATE { \
36 "VISION_SPEED_ESTIMATE", \
37 4, \
38 { { "usec", NULL, MAVLINK_TYPE_UINT64_T, 0, 0, offsetof(mavlink_vision_speed_estimate_t, usec) }, \
39 { "x", NULL, MAVLINK_TYPE_FLOAT, 0, 8, offsetof(mavlink_vision_speed_estimate_t, x) }, \
40 { "y", NULL, MAVLINK_TYPE_FLOAT, 0, 12, offsetof(mavlink_vision_speed_estimate_t, y) }, \
41 { "z", NULL, MAVLINK_TYPE_FLOAT, 0, 16, offsetof(mavlink_vision_speed_estimate_t, z) }, \
42 } \
43}
44#endif
45
46/**
47 * @brief Pack a vision_speed_estimate message
48 * @param system_id ID of this system
49 * @param component_id ID of this component (e.g. 200 for IMU)
50 * @param msg The MAVLink message to compress the data into
51 *
52 * @param usec Timestamp (microseconds, synced to UNIX time or since system boot)
53 * @param x Global X speed
54 * @param y Global Y speed
55 * @param z Global Z speed
56 * @return length of the message in bytes (excluding serial stream start sign)
57 */
58static inline uint16_t mavlink_msg_vision_speed_estimate_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg,
59 uint64_t usec, float x, float y, float z)
60{
61#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
62 char buf[MAVLINK_MSG_ID_VISION_SPEED_ESTIMATE_LEN];
63 _mav_put_uint64_t(buf, 0, usec);
64 _mav_put_float(buf, 8, x);
65 _mav_put_float(buf, 12, y);
66 _mav_put_float(buf, 16, z);
67
68 memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_VISION_SPEED_ESTIMATE_LEN);
69#else
70 mavlink_vision_speed_estimate_t packet;
71 packet.usec = usec;
72 packet.x = x;
73 packet.y = y;
74 packet.z = z;
75
76 memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_VISION_SPEED_ESTIMATE_LEN);
77#endif
78
79 msg->msgid = MAVLINK_MSG_ID_VISION_SPEED_ESTIMATE;
80 return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_VISION_SPEED_ESTIMATE_MIN_LEN, MAVLINK_MSG_ID_VISION_SPEED_ESTIMATE_LEN, MAVLINK_MSG_ID_VISION_SPEED_ESTIMATE_CRC);
81}
82
83/**
84 * @brief Pack a vision_speed_estimate message on a channel
85 * @param system_id ID of this system
86 * @param component_id ID of this component (e.g. 200 for IMU)
87 * @param chan The MAVLink channel this message will be sent over
88 * @param msg The MAVLink message to compress the data into
89 * @param usec Timestamp (microseconds, synced to UNIX time or since system boot)
90 * @param x Global X speed
91 * @param y Global Y speed
92 * @param z Global Z speed
93 * @return length of the message in bytes (excluding serial stream start sign)
94 */
95static inline uint16_t mavlink_msg_vision_speed_estimate_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan,
96 mavlink_message_t* msg,
97 uint64_t usec,float x,float y,float z)
98{
99#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
100 char buf[MAVLINK_MSG_ID_VISION_SPEED_ESTIMATE_LEN];
101 _mav_put_uint64_t(buf, 0, usec);
102 _mav_put_float(buf, 8, x);
103 _mav_put_float(buf, 12, y);
104 _mav_put_float(buf, 16, z);
105
106 memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_VISION_SPEED_ESTIMATE_LEN);
107#else
108 mavlink_vision_speed_estimate_t packet;
109 packet.usec = usec;
110 packet.x = x;
111 packet.y = y;
112 packet.z = z;
113
114 memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_VISION_SPEED_ESTIMATE_LEN);
115#endif
116
117 msg->msgid = MAVLINK_MSG_ID_VISION_SPEED_ESTIMATE;
118 return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_VISION_SPEED_ESTIMATE_MIN_LEN, MAVLINK_MSG_ID_VISION_SPEED_ESTIMATE_LEN, MAVLINK_MSG_ID_VISION_SPEED_ESTIMATE_CRC);
119}
120
121/**
122 * @brief Encode a vision_speed_estimate struct
123 *
124 * @param system_id ID of this system
125 * @param component_id ID of this component (e.g. 200 for IMU)
126 * @param msg The MAVLink message to compress the data into
127 * @param vision_speed_estimate C-struct to read the message contents from
128 */
129static inline uint16_t mavlink_msg_vision_speed_estimate_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_vision_speed_estimate_t* vision_speed_estimate)
130{
131 return mavlink_msg_vision_speed_estimate_pack(system_id, component_id, msg, vision_speed_estimate->usec, vision_speed_estimate->x, vision_speed_estimate->y, vision_speed_estimate->z);
132}
133
134/**
135 * @brief Encode a vision_speed_estimate struct on a channel
136 *
137 * @param system_id ID of this system
138 * @param component_id ID of this component (e.g. 200 for IMU)
139 * @param chan The MAVLink channel this message will be sent over
140 * @param msg The MAVLink message to compress the data into
141 * @param vision_speed_estimate C-struct to read the message contents from
142 */
143static inline uint16_t mavlink_msg_vision_speed_estimate_encode_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, const mavlink_vision_speed_estimate_t* vision_speed_estimate)
144{
145 return mavlink_msg_vision_speed_estimate_pack_chan(system_id, component_id, chan, msg, vision_speed_estimate->usec, vision_speed_estimate->x, vision_speed_estimate->y, vision_speed_estimate->z);
146}
147
148/**
149 * @brief Send a vision_speed_estimate message
150 * @param chan MAVLink channel to send the message
151 *
152 * @param usec Timestamp (microseconds, synced to UNIX time or since system boot)
153 * @param x Global X speed
154 * @param y Global Y speed
155 * @param z Global Z speed
156 */
157#ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS
158
159static inline void mavlink_msg_vision_speed_estimate_send(mavlink_channel_t chan, uint64_t usec, float x, float y, float z)
160{
161#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
162 char buf[MAVLINK_MSG_ID_VISION_SPEED_ESTIMATE_LEN];
163 _mav_put_uint64_t(buf, 0, usec);
164 _mav_put_float(buf, 8, x);
165 _mav_put_float(buf, 12, y);
166 _mav_put_float(buf, 16, z);
167
168 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_VISION_SPEED_ESTIMATE, buf, MAVLINK_MSG_ID_VISION_SPEED_ESTIMATE_MIN_LEN, MAVLINK_MSG_ID_VISION_SPEED_ESTIMATE_LEN, MAVLINK_MSG_ID_VISION_SPEED_ESTIMATE_CRC);
169#else
170 mavlink_vision_speed_estimate_t packet;
171 packet.usec = usec;
172 packet.x = x;
173 packet.y = y;
174 packet.z = z;
175
176 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_VISION_SPEED_ESTIMATE, (const char *)&packet, MAVLINK_MSG_ID_VISION_SPEED_ESTIMATE_MIN_LEN, MAVLINK_MSG_ID_VISION_SPEED_ESTIMATE_LEN, MAVLINK_MSG_ID_VISION_SPEED_ESTIMATE_CRC);
177#endif
178}
179
180/**
181 * @brief Send a vision_speed_estimate message
182 * @param chan MAVLink channel to send the message
183 * @param struct The MAVLink struct to serialize
184 */
185static inline void mavlink_msg_vision_speed_estimate_send_struct(mavlink_channel_t chan, const mavlink_vision_speed_estimate_t* vision_speed_estimate)
186{
187#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
188 mavlink_msg_vision_speed_estimate_send(chan, vision_speed_estimate->usec, vision_speed_estimate->x, vision_speed_estimate->y, vision_speed_estimate->z);
189#else
190 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_VISION_SPEED_ESTIMATE, (const char *)vision_speed_estimate, MAVLINK_MSG_ID_VISION_SPEED_ESTIMATE_MIN_LEN, MAVLINK_MSG_ID_VISION_SPEED_ESTIMATE_LEN, MAVLINK_MSG_ID_VISION_SPEED_ESTIMATE_CRC);
191#endif
192}
193
194#if MAVLINK_MSG_ID_VISION_SPEED_ESTIMATE_LEN <= MAVLINK_MAX_PAYLOAD_LEN
195/*
196 This varient of _send() can be used to save stack space by re-using
197 memory from the receive buffer. The caller provides a
198 mavlink_message_t which is the size of a full mavlink message. This
199 is usually the receive buffer for the channel, and allows a reply to an
200 incoming message with minimum stack space usage.
201 */
202static inline void mavlink_msg_vision_speed_estimate_send_buf(mavlink_message_t *msgbuf, mavlink_channel_t chan, uint64_t usec, float x, float y, float z)
203{
204#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
205 char *buf = (char *)msgbuf;
206 _mav_put_uint64_t(buf, 0, usec);
207 _mav_put_float(buf, 8, x);
208 _mav_put_float(buf, 12, y);
209 _mav_put_float(buf, 16, z);
210
211 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_VISION_SPEED_ESTIMATE, buf, MAVLINK_MSG_ID_VISION_SPEED_ESTIMATE_MIN_LEN, MAVLINK_MSG_ID_VISION_SPEED_ESTIMATE_LEN, MAVLINK_MSG_ID_VISION_SPEED_ESTIMATE_CRC);
212#else
213 mavlink_vision_speed_estimate_t *packet = (mavlink_vision_speed_estimate_t *)msgbuf;
214 packet->usec = usec;
215 packet->x = x;
216 packet->y = y;
217 packet->z = z;
218
219 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_VISION_SPEED_ESTIMATE, (const char *)packet, MAVLINK_MSG_ID_VISION_SPEED_ESTIMATE_MIN_LEN, MAVLINK_MSG_ID_VISION_SPEED_ESTIMATE_LEN, MAVLINK_MSG_ID_VISION_SPEED_ESTIMATE_CRC);
220#endif
221}
222#endif
223
224#endif
225
226// MESSAGE VISION_SPEED_ESTIMATE UNPACKING
227
228
229/**
230 * @brief Get field usec from vision_speed_estimate message
231 *
232 * @return Timestamp (microseconds, synced to UNIX time or since system boot)
233 */
234static inline uint64_t mavlink_msg_vision_speed_estimate_get_usec(const mavlink_message_t* msg)
235{
236 return _MAV_RETURN_uint64_t(msg, 0);
237}
238
239/**
240 * @brief Get field x from vision_speed_estimate message
241 *
242 * @return Global X speed
243 */
244static inline float mavlink_msg_vision_speed_estimate_get_x(const mavlink_message_t* msg)
245{
246 return _MAV_RETURN_float(msg, 8);
247}
248
249/**
250 * @brief Get field y from vision_speed_estimate message
251 *
252 * @return Global Y speed
253 */
254static inline float mavlink_msg_vision_speed_estimate_get_y(const mavlink_message_t* msg)
255{
256 return _MAV_RETURN_float(msg, 12);
257}
258
259/**
260 * @brief Get field z from vision_speed_estimate message
261 *
262 * @return Global Z speed
263 */
264static inline float mavlink_msg_vision_speed_estimate_get_z(const mavlink_message_t* msg)
265{
266 return _MAV_RETURN_float(msg, 16);
267}
268
269/**
270 * @brief Decode a vision_speed_estimate message into a struct
271 *
272 * @param msg The message to decode
273 * @param vision_speed_estimate C-struct to decode the message contents into
274 */
275static inline void mavlink_msg_vision_speed_estimate_decode(const mavlink_message_t* msg, mavlink_vision_speed_estimate_t* vision_speed_estimate)
276{
277#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
278 vision_speed_estimate->usec = mavlink_msg_vision_speed_estimate_get_usec(msg);
279 vision_speed_estimate->x = mavlink_msg_vision_speed_estimate_get_x(msg);
280 vision_speed_estimate->y = mavlink_msg_vision_speed_estimate_get_y(msg);
281 vision_speed_estimate->z = mavlink_msg_vision_speed_estimate_get_z(msg);
282#else
283 uint8_t len = msg->len < MAVLINK_MSG_ID_VISION_SPEED_ESTIMATE_LEN? msg->len : MAVLINK_MSG_ID_VISION_SPEED_ESTIMATE_LEN;
284 memset(vision_speed_estimate, 0, MAVLINK_MSG_ID_VISION_SPEED_ESTIMATE_LEN);
285 memcpy(vision_speed_estimate, _MAV_PAYLOAD(msg), len);
286#endif
287}
Note: See TracBrowser for help on using the repository browser.