Merged in f5soh/librepilot/update_credits (pull request #529)
[librepilot.git] / flight / libraries / mavlink / v1.0 / common / mavlink_msg_vicon_position_estimate.h
blobb4baca63d2bfba51fc8f1966f7f8f5908da04e27
1 // MESSAGE VICON_POSITION_ESTIMATE PACKING
3 #define MAVLINK_MSG_ID_VICON_POSITION_ESTIMATE 104
5 typedef struct __mavlink_vicon_position_estimate_t {
6 uint64_t usec; ///< Timestamp (milliseconds)
7 float x; ///< Global X position
8 float y; ///< Global Y position
9 float z; ///< Global Z position
10 float roll; ///< Roll angle in rad
11 float pitch; ///< Pitch angle in rad
12 float yaw; ///< Yaw angle in rad
13 } mavlink_vicon_position_estimate_t;
15 #define MAVLINK_MSG_ID_VICON_POSITION_ESTIMATE_LEN 32
16 #define MAVLINK_MSG_ID_104_LEN 32
19 #define MAVLINK_MESSAGE_INFO_VICON_POSITION_ESTIMATE \
20 { \
21 "VICON_POSITION_ESTIMATE", \
22 7, \
23 { \
24 { "usec", NULL, MAVLINK_TYPE_UINT64_T, 0, 0, offsetof(mavlink_vicon_position_estimate_t, usec) }, \
25 { "x", NULL, MAVLINK_TYPE_FLOAT, 0, 8, offsetof(mavlink_vicon_position_estimate_t, x) }, \
26 { "y", NULL, MAVLINK_TYPE_FLOAT, 0, 12, offsetof(mavlink_vicon_position_estimate_t, y) }, \
27 { "z", NULL, MAVLINK_TYPE_FLOAT, 0, 16, offsetof(mavlink_vicon_position_estimate_t, z) }, \
28 { "roll", NULL, MAVLINK_TYPE_FLOAT, 0, 20, offsetof(mavlink_vicon_position_estimate_t, roll) }, \
29 { "pitch", NULL, MAVLINK_TYPE_FLOAT, 0, 24, offsetof(mavlink_vicon_position_estimate_t, pitch) }, \
30 { "yaw", NULL, MAVLINK_TYPE_FLOAT, 0, 28, offsetof(mavlink_vicon_position_estimate_t, yaw) }, \
31 } \
35 /**
36 * @brief Pack a vicon_position_estimate message
37 * @param system_id ID of this system
38 * @param component_id ID of this component (e.g. 200 for IMU)
39 * @param msg The MAVLink message to compress the data into
41 * @param usec Timestamp (milliseconds)
42 * @param x Global X position
43 * @param y Global Y position
44 * @param z Global Z position
45 * @param roll Roll angle in rad
46 * @param pitch Pitch angle in rad
47 * @param yaw Yaw angle in rad
48 * @return length of the message in bytes (excluding serial stream start sign)
50 static inline uint16_t mavlink_msg_vicon_position_estimate_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t *msg,
51 uint64_t usec, float x, float y, float z, float roll, float pitch, float yaw)
53 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
54 char buf[32];
55 _mav_put_uint64_t(buf, 0, usec);
56 _mav_put_float(buf, 8, x);
57 _mav_put_float(buf, 12, y);
58 _mav_put_float(buf, 16, z);
59 _mav_put_float(buf, 20, roll);
60 _mav_put_float(buf, 24, pitch);
61 _mav_put_float(buf, 28, yaw);
63 memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, 32);
64 #else
65 mavlink_vicon_position_estimate_t packet;
66 packet.usec = usec;
67 packet.x = x;
68 packet.y = y;
69 packet.z = z;
70 packet.roll = roll;
71 packet.pitch = pitch;
72 packet.yaw = yaw;
74 memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, 32);
75 #endif // if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
77 msg->msgid = MAVLINK_MSG_ID_VICON_POSITION_ESTIMATE;
78 return mavlink_finalize_message(msg, system_id, component_id, 32, 56);
81 /**
82 * @brief Pack a vicon_position_estimate message on a channel
83 * @param system_id ID of this system
84 * @param component_id ID of this component (e.g. 200 for IMU)
85 * @param chan The MAVLink channel this message was sent over
86 * @param msg The MAVLink message to compress the data into
87 * @param usec Timestamp (milliseconds)
88 * @param x Global X position
89 * @param y Global Y position
90 * @param z Global Z position
91 * @param roll Roll angle in rad
92 * @param pitch Pitch angle in rad
93 * @param yaw Yaw angle in rad
94 * @return length of the message in bytes (excluding serial stream start sign)
96 static inline uint16_t mavlink_msg_vicon_position_estimate_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan,
97 mavlink_message_t *msg,
98 uint64_t usec, float x, float y, float z, float roll, float pitch, float yaw)
100 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
101 char buf[32];
102 _mav_put_uint64_t(buf, 0, usec);
103 _mav_put_float(buf, 8, x);
104 _mav_put_float(buf, 12, y);
105 _mav_put_float(buf, 16, z);
106 _mav_put_float(buf, 20, roll);
107 _mav_put_float(buf, 24, pitch);
108 _mav_put_float(buf, 28, yaw);
110 memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, 32);
111 #else
112 mavlink_vicon_position_estimate_t packet;
113 packet.usec = usec;
114 packet.x = x;
115 packet.y = y;
116 packet.z = z;
117 packet.roll = roll;
118 packet.pitch = pitch;
119 packet.yaw = yaw;
121 memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, 32);
122 #endif // if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
124 msg->msgid = MAVLINK_MSG_ID_VICON_POSITION_ESTIMATE;
125 return mavlink_finalize_message_chan(msg, system_id, component_id, chan, 32, 56);
129 * @brief Encode a vicon_position_estimate struct into a message
131 * @param system_id ID of this system
132 * @param component_id ID of this component (e.g. 200 for IMU)
133 * @param msg The MAVLink message to compress the data into
134 * @param vicon_position_estimate C-struct to read the message contents from
136 static inline uint16_t mavlink_msg_vicon_position_estimate_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t *msg, const mavlink_vicon_position_estimate_t *vicon_position_estimate)
138 return mavlink_msg_vicon_position_estimate_pack(system_id, component_id, msg, vicon_position_estimate->usec, vicon_position_estimate->x, vicon_position_estimate->y, vicon_position_estimate->z, vicon_position_estimate->roll, vicon_position_estimate->pitch, vicon_position_estimate->yaw);
142 * @brief Send a vicon_position_estimate message
143 * @param chan MAVLink channel to send the message
145 * @param usec Timestamp (milliseconds)
146 * @param x Global X position
147 * @param y Global Y position
148 * @param z Global Z position
149 * @param roll Roll angle in rad
150 * @param pitch Pitch angle in rad
151 * @param yaw Yaw angle in rad
153 #ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS
155 static inline void mavlink_msg_vicon_position_estimate_send(mavlink_channel_t chan, uint64_t usec, float x, float y, float z, float roll, float pitch, float yaw)
157 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
158 char buf[32];
159 _mav_put_uint64_t(buf, 0, usec);
160 _mav_put_float(buf, 8, x);
161 _mav_put_float(buf, 12, y);
162 _mav_put_float(buf, 16, z);
163 _mav_put_float(buf, 20, roll);
164 _mav_put_float(buf, 24, pitch);
165 _mav_put_float(buf, 28, yaw);
167 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_VICON_POSITION_ESTIMATE, buf, 32, 56);
168 #else
169 mavlink_vicon_position_estimate_t packet;
170 packet.usec = usec;
171 packet.x = x;
172 packet.y = y;
173 packet.z = z;
174 packet.roll = roll;
175 packet.pitch = pitch;
176 packet.yaw = yaw;
178 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_VICON_POSITION_ESTIMATE, (const char *)&packet, 32, 56);
179 #endif // if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
182 #endif // ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS
184 // MESSAGE VICON_POSITION_ESTIMATE UNPACKING
188 * @brief Get field usec from vicon_position_estimate message
190 * @return Timestamp (milliseconds)
192 static inline uint64_t mavlink_msg_vicon_position_estimate_get_usec(const mavlink_message_t *msg)
194 return _MAV_RETURN_uint64_t(msg, 0);
198 * @brief Get field x from vicon_position_estimate message
200 * @return Global X position
202 static inline float mavlink_msg_vicon_position_estimate_get_x(const mavlink_message_t *msg)
204 return _MAV_RETURN_float(msg, 8);
208 * @brief Get field y from vicon_position_estimate message
210 * @return Global Y position
212 static inline float mavlink_msg_vicon_position_estimate_get_y(const mavlink_message_t *msg)
214 return _MAV_RETURN_float(msg, 12);
218 * @brief Get field z from vicon_position_estimate message
220 * @return Global Z position
222 static inline float mavlink_msg_vicon_position_estimate_get_z(const mavlink_message_t *msg)
224 return _MAV_RETURN_float(msg, 16);
228 * @brief Get field roll from vicon_position_estimate message
230 * @return Roll angle in rad
232 static inline float mavlink_msg_vicon_position_estimate_get_roll(const mavlink_message_t *msg)
234 return _MAV_RETURN_float(msg, 20);
238 * @brief Get field pitch from vicon_position_estimate message
240 * @return Pitch angle in rad
242 static inline float mavlink_msg_vicon_position_estimate_get_pitch(const mavlink_message_t *msg)
244 return _MAV_RETURN_float(msg, 24);
248 * @brief Get field yaw from vicon_position_estimate message
250 * @return Yaw angle in rad
252 static inline float mavlink_msg_vicon_position_estimate_get_yaw(const mavlink_message_t *msg)
254 return _MAV_RETURN_float(msg, 28);
258 * @brief Decode a vicon_position_estimate message into a struct
260 * @param msg The message to decode
261 * @param vicon_position_estimate C-struct to decode the message contents into
263 static inline void mavlink_msg_vicon_position_estimate_decode(const mavlink_message_t *msg, mavlink_vicon_position_estimate_t *vicon_position_estimate)
265 #if MAVLINK_NEED_BYTE_SWAP
266 vicon_position_estimate->usec = mavlink_msg_vicon_position_estimate_get_usec(msg);
267 vicon_position_estimate->x = mavlink_msg_vicon_position_estimate_get_x(msg);
268 vicon_position_estimate->y = mavlink_msg_vicon_position_estimate_get_y(msg);
269 vicon_position_estimate->z = mavlink_msg_vicon_position_estimate_get_z(msg);
270 vicon_position_estimate->roll = mavlink_msg_vicon_position_estimate_get_roll(msg);
271 vicon_position_estimate->pitch = mavlink_msg_vicon_position_estimate_get_pitch(msg);
272 vicon_position_estimate->yaw = mavlink_msg_vicon_position_estimate_get_yaw(msg);
273 #else
274 memcpy(vicon_position_estimate, _MAV_PAYLOAD(msg), 32);
275 #endif