Arduino Mavlink
Loading...
Searching...
No Matches
mavlink_msg_trajectory_representation_waypoints.h
Go to the documentation of this file.
1#pragma once
2// MESSAGE TRAJECTORY_REPRESENTATION_WAYPOINTS PACKING
3
4#define MAVLINK_MSG_ID_TRAJECTORY_REPRESENTATION_WAYPOINTS 332
5
6
8 uint64_t time_usec; /*< [us] Timestamp (UNIX Epoch time or time since system boot). The receiving end can infer timestamp format (since 1.1.1970 or since system boot) by checking for the magnitude of the number.*/
9 float pos_x[5]; /*< [m] X-coordinate of waypoint, set to NaN if not being used*/
10 float pos_y[5]; /*< [m] Y-coordinate of waypoint, set to NaN if not being used*/
11 float pos_z[5]; /*< [m] Z-coordinate of waypoint, set to NaN if not being used*/
12 float vel_x[5]; /*< [m/s] X-velocity of waypoint, set to NaN if not being used*/
13 float vel_y[5]; /*< [m/s] Y-velocity of waypoint, set to NaN if not being used*/
14 float vel_z[5]; /*< [m/s] Z-velocity of waypoint, set to NaN if not being used*/
15 float acc_x[5]; /*< [m/s/s] X-acceleration of waypoint, set to NaN if not being used*/
16 float acc_y[5]; /*< [m/s/s] Y-acceleration of waypoint, set to NaN if not being used*/
17 float acc_z[5]; /*< [m/s/s] Z-acceleration of waypoint, set to NaN if not being used*/
18 float pos_yaw[5]; /*< [rad] Yaw angle, set to NaN if not being used*/
19 float vel_yaw[5]; /*< [rad/s] Yaw rate, set to NaN if not being used*/
20 uint16_t command[5]; /*< MAV_CMD command id of waypoint, set to UINT16_MAX if not being used.*/
21 uint8_t valid_points; /*< Number of valid points (up-to 5 waypoints are possible)*/
22} mavlink_trajectory_representation_waypoints_t;
23
24#define MAVLINK_MSG_ID_TRAJECTORY_REPRESENTATION_WAYPOINTS_LEN 239
25#define MAVLINK_MSG_ID_TRAJECTORY_REPRESENTATION_WAYPOINTS_MIN_LEN 239
26#define MAVLINK_MSG_ID_332_LEN 239
27#define MAVLINK_MSG_ID_332_MIN_LEN 239
28
29#define MAVLINK_MSG_ID_TRAJECTORY_REPRESENTATION_WAYPOINTS_CRC 236
30#define MAVLINK_MSG_ID_332_CRC 236
31
32#define MAVLINK_MSG_TRAJECTORY_REPRESENTATION_WAYPOINTS_FIELD_POS_X_LEN 5
33#define MAVLINK_MSG_TRAJECTORY_REPRESENTATION_WAYPOINTS_FIELD_POS_Y_LEN 5
34#define MAVLINK_MSG_TRAJECTORY_REPRESENTATION_WAYPOINTS_FIELD_POS_Z_LEN 5
35#define MAVLINK_MSG_TRAJECTORY_REPRESENTATION_WAYPOINTS_FIELD_VEL_X_LEN 5
36#define MAVLINK_MSG_TRAJECTORY_REPRESENTATION_WAYPOINTS_FIELD_VEL_Y_LEN 5
37#define MAVLINK_MSG_TRAJECTORY_REPRESENTATION_WAYPOINTS_FIELD_VEL_Z_LEN 5
38#define MAVLINK_MSG_TRAJECTORY_REPRESENTATION_WAYPOINTS_FIELD_ACC_X_LEN 5
39#define MAVLINK_MSG_TRAJECTORY_REPRESENTATION_WAYPOINTS_FIELD_ACC_Y_LEN 5
40#define MAVLINK_MSG_TRAJECTORY_REPRESENTATION_WAYPOINTS_FIELD_ACC_Z_LEN 5
41#define MAVLINK_MSG_TRAJECTORY_REPRESENTATION_WAYPOINTS_FIELD_POS_YAW_LEN 5
42#define MAVLINK_MSG_TRAJECTORY_REPRESENTATION_WAYPOINTS_FIELD_VEL_YAW_LEN 5
43#define MAVLINK_MSG_TRAJECTORY_REPRESENTATION_WAYPOINTS_FIELD_COMMAND_LEN 5
44
45#if MAVLINK_COMMAND_24BIT
46#define MAVLINK_MESSAGE_INFO_TRAJECTORY_REPRESENTATION_WAYPOINTS {
47 332,
48 "TRAJECTORY_REPRESENTATION_WAYPOINTS",
49 14,
50 { { "time_usec", NULL, MAVLINK_TYPE_UINT64_T, 0, 0, offsetof(mavlink_trajectory_representation_waypoints_t, time_usec) },
51 { "valid_points", NULL, MAVLINK_TYPE_UINT8_T, 0, 238, offsetof(mavlink_trajectory_representation_waypoints_t, valid_points) },
52 { "pos_x", NULL, MAVLINK_TYPE_FLOAT, 5, 8, offsetof(mavlink_trajectory_representation_waypoints_t, pos_x) },
53 { "pos_y", NULL, MAVLINK_TYPE_FLOAT, 5, 28, offsetof(mavlink_trajectory_representation_waypoints_t, pos_y) },
54 { "pos_z", NULL, MAVLINK_TYPE_FLOAT, 5, 48, offsetof(mavlink_trajectory_representation_waypoints_t, pos_z) },
55 { "vel_x", NULL, MAVLINK_TYPE_FLOAT, 5, 68, offsetof(mavlink_trajectory_representation_waypoints_t, vel_x) },
56 { "vel_y", NULL, MAVLINK_TYPE_FLOAT, 5, 88, offsetof(mavlink_trajectory_representation_waypoints_t, vel_y) },
57 { "vel_z", NULL, MAVLINK_TYPE_FLOAT, 5, 108, offsetof(mavlink_trajectory_representation_waypoints_t, vel_z) },
58 { "acc_x", NULL, MAVLINK_TYPE_FLOAT, 5, 128, offsetof(mavlink_trajectory_representation_waypoints_t, acc_x) },
59 { "acc_y", NULL, MAVLINK_TYPE_FLOAT, 5, 148, offsetof(mavlink_trajectory_representation_waypoints_t, acc_y) },
60 { "acc_z", NULL, MAVLINK_TYPE_FLOAT, 5, 168, offsetof(mavlink_trajectory_representation_waypoints_t, acc_z) },
61 { "pos_yaw", NULL, MAVLINK_TYPE_FLOAT, 5, 188, offsetof(mavlink_trajectory_representation_waypoints_t, pos_yaw) },
62 { "vel_yaw", NULL, MAVLINK_TYPE_FLOAT, 5, 208, offsetof(mavlink_trajectory_representation_waypoints_t, vel_yaw) },
63 { "command", NULL, MAVLINK_TYPE_UINT16_T, 5, 228, offsetof(mavlink_trajectory_representation_waypoints_t, command) },
64 } \
65}
66#else
67#define MAVLINK_MESSAGE_INFO_TRAJECTORY_REPRESENTATION_WAYPOINTS {
68 "TRAJECTORY_REPRESENTATION_WAYPOINTS",
69 14,
70 { { "time_usec", NULL, MAVLINK_TYPE_UINT64_T, 0, 0, offsetof(mavlink_trajectory_representation_waypoints_t, time_usec) },
71 { "valid_points", NULL, MAVLINK_TYPE_UINT8_T, 0, 238, offsetof(mavlink_trajectory_representation_waypoints_t, valid_points) },
72 { "pos_x", NULL, MAVLINK_TYPE_FLOAT, 5, 8, offsetof(mavlink_trajectory_representation_waypoints_t, pos_x) },
73 { "pos_y", NULL, MAVLINK_TYPE_FLOAT, 5, 28, offsetof(mavlink_trajectory_representation_waypoints_t, pos_y) },
74 { "pos_z", NULL, MAVLINK_TYPE_FLOAT, 5, 48, offsetof(mavlink_trajectory_representation_waypoints_t, pos_z) },
75 { "vel_x", NULL, MAVLINK_TYPE_FLOAT, 5, 68, offsetof(mavlink_trajectory_representation_waypoints_t, vel_x) },
76 { "vel_y", NULL, MAVLINK_TYPE_FLOAT, 5, 88, offsetof(mavlink_trajectory_representation_waypoints_t, vel_y) },
77 { "vel_z", NULL, MAVLINK_TYPE_FLOAT, 5, 108, offsetof(mavlink_trajectory_representation_waypoints_t, vel_z) },
78 { "acc_x", NULL, MAVLINK_TYPE_FLOAT, 5, 128, offsetof(mavlink_trajectory_representation_waypoints_t, acc_x) },
79 { "acc_y", NULL, MAVLINK_TYPE_FLOAT, 5, 148, offsetof(mavlink_trajectory_representation_waypoints_t, acc_y) },
80 { "acc_z", NULL, MAVLINK_TYPE_FLOAT, 5, 168, offsetof(mavlink_trajectory_representation_waypoints_t, acc_z) },
81 { "pos_yaw", NULL, MAVLINK_TYPE_FLOAT, 5, 188, offsetof(mavlink_trajectory_representation_waypoints_t, pos_yaw) },
82 { "vel_yaw", NULL, MAVLINK_TYPE_FLOAT, 5, 208, offsetof(mavlink_trajectory_representation_waypoints_t, vel_yaw) },
83 { "command", NULL, MAVLINK_TYPE_UINT16_T, 5, 228, offsetof(mavlink_trajectory_representation_waypoints_t, command) },
84 } \
85}
86#endif
87
88/**
89 * @brief Pack a trajectory_representation_waypoints message
90 * @param system_id ID of this system
91 * @param component_id ID of this component (e.g. 200 for IMU)
92 * @param msg The MAVLink message to compress the data into
93 *
94 * @param time_usec [us] Timestamp (UNIX Epoch time or time since system boot). The receiving end can infer timestamp format (since 1.1.1970 or since system boot) by checking for the magnitude of the number.
95 * @param valid_points Number of valid points (up-to 5 waypoints are possible)
96 * @param pos_x [m] X-coordinate of waypoint, set to NaN if not being used
97 * @param pos_y [m] Y-coordinate of waypoint, set to NaN if not being used
98 * @param pos_z [m] Z-coordinate of waypoint, set to NaN if not being used
99 * @param vel_x [m/s] X-velocity of waypoint, set to NaN if not being used
100 * @param vel_y [m/s] Y-velocity of waypoint, set to NaN if not being used
101 * @param vel_z [m/s] Z-velocity of waypoint, set to NaN if not being used
102 * @param acc_x [m/s/s] X-acceleration of waypoint, set to NaN if not being used
103 * @param acc_y [m/s/s] Y-acceleration of waypoint, set to NaN if not being used
104 * @param acc_z [m/s/s] Z-acceleration of waypoint, set to NaN if not being used
105 * @param pos_yaw [rad] Yaw angle, set to NaN if not being used
106 * @param vel_yaw [rad/s] Yaw rate, set to NaN if not being used
107 * @param command MAV_CMD command id of waypoint, set to UINT16_MAX if not being used.
108 * @return length of the message in bytes (excluding serial stream start sign)
109 */
110static inline uint16_t mavlink_msg_trajectory_representation_waypoints_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg,
111 uint64_t time_usec, uint8_t valid_points, const float *pos_x, const float *pos_y, const float *pos_z, const float *vel_x, const float *vel_y, const float *vel_z, const float *acc_x, const float *acc_y, const float *acc_z, const float *pos_yaw, const float *vel_yaw, const uint16_t *command)
112{
113#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
115 _mav_put_uint64_t(buf, 0, time_usec);
116 _mav_put_uint8_t(buf, 238, valid_points);
117 _mav_put_float_array(buf, 8, pos_x, 5);
118 _mav_put_float_array(buf, 28, pos_y, 5);
119 _mav_put_float_array(buf, 48, pos_z, 5);
120 _mav_put_float_array(buf, 68, vel_x, 5);
121 _mav_put_float_array(buf, 88, vel_y, 5);
122 _mav_put_float_array(buf, 108, vel_z, 5);
123 _mav_put_float_array(buf, 128, acc_x, 5);
124 _mav_put_float_array(buf, 148, acc_y, 5);
125 _mav_put_float_array(buf, 168, acc_z, 5);
126 _mav_put_float_array(buf, 188, pos_yaw, 5);
127 _mav_put_float_array(buf, 208, vel_yaw, 5);
128 _mav_put_uint16_t_array(buf, 228, command, 5);
129 memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_TRAJECTORY_REPRESENTATION_WAYPOINTS_LEN);
130#else
131 mavlink_trajectory_representation_waypoints_t packet;
132 packet.time_usec = time_usec;
133 packet.valid_points = valid_points;
134 mav_array_memcpy(packet.pos_x, pos_x, sizeof(float)*5);
135 mav_array_memcpy(packet.pos_y, pos_y, sizeof(float)*5);
136 mav_array_memcpy(packet.pos_z, pos_z, sizeof(float)*5);
137 mav_array_memcpy(packet.vel_x, vel_x, sizeof(float)*5);
138 mav_array_memcpy(packet.vel_y, vel_y, sizeof(float)*5);
139 mav_array_memcpy(packet.vel_z, vel_z, sizeof(float)*5);
140 mav_array_memcpy(packet.acc_x, acc_x, sizeof(float)*5);
141 mav_array_memcpy(packet.acc_y, acc_y, sizeof(float)*5);
142 mav_array_memcpy(packet.acc_z, acc_z, sizeof(float)*5);
143 mav_array_memcpy(packet.pos_yaw, pos_yaw, sizeof(float)*5);
144 mav_array_memcpy(packet.vel_yaw, vel_yaw, sizeof(float)*5);
145 mav_array_memcpy(packet.command, command, sizeof(uint16_t)*5);
146 memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_TRAJECTORY_REPRESENTATION_WAYPOINTS_LEN);
147#endif
148
151}
152
153/**
154 * @brief Pack a trajectory_representation_waypoints message
155 * @param system_id ID of this system
156 * @param component_id ID of this component (e.g. 200 for IMU)
157 * @param status MAVLink status structure
158 * @param msg The MAVLink message to compress the data into
159 *
160 * @param time_usec [us] Timestamp (UNIX Epoch time or time since system boot). The receiving end can infer timestamp format (since 1.1.1970 or since system boot) by checking for the magnitude of the number.
161 * @param valid_points Number of valid points (up-to 5 waypoints are possible)
162 * @param pos_x [m] X-coordinate of waypoint, set to NaN if not being used
163 * @param pos_y [m] Y-coordinate of waypoint, set to NaN if not being used
164 * @param pos_z [m] Z-coordinate of waypoint, set to NaN if not being used
165 * @param vel_x [m/s] X-velocity of waypoint, set to NaN if not being used
166 * @param vel_y [m/s] Y-velocity of waypoint, set to NaN if not being used
167 * @param vel_z [m/s] Z-velocity of waypoint, set to NaN if not being used
168 * @param acc_x [m/s/s] X-acceleration of waypoint, set to NaN if not being used
169 * @param acc_y [m/s/s] Y-acceleration of waypoint, set to NaN if not being used
170 * @param acc_z [m/s/s] Z-acceleration of waypoint, set to NaN if not being used
171 * @param pos_yaw [rad] Yaw angle, set to NaN if not being used
172 * @param vel_yaw [rad/s] Yaw rate, set to NaN if not being used
173 * @param command MAV_CMD command id of waypoint, set to UINT16_MAX if not being used.
174 * @return length of the message in bytes (excluding serial stream start sign)
175 */
176static inline uint16_t mavlink_msg_trajectory_representation_waypoints_pack_status(uint8_t system_id, uint8_t component_id, mavlink_status_t *_status, mavlink_message_t* msg,
177 uint64_t time_usec, uint8_t valid_points, const float *pos_x, const float *pos_y, const float *pos_z, const float *vel_x, const float *vel_y, const float *vel_z, const float *acc_x, const float *acc_y, const float *acc_z, const float *pos_yaw, const float *vel_yaw, const uint16_t *command)
178{
179#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
181 _mav_put_uint64_t(buf, 0, time_usec);
182 _mav_put_uint8_t(buf, 238, valid_points);
183 _mav_put_float_array(buf, 8, pos_x, 5);
184 _mav_put_float_array(buf, 28, pos_y, 5);
185 _mav_put_float_array(buf, 48, pos_z, 5);
186 _mav_put_float_array(buf, 68, vel_x, 5);
187 _mav_put_float_array(buf, 88, vel_y, 5);
188 _mav_put_float_array(buf, 108, vel_z, 5);
189 _mav_put_float_array(buf, 128, acc_x, 5);
190 _mav_put_float_array(buf, 148, acc_y, 5);
191 _mav_put_float_array(buf, 168, acc_z, 5);
192 _mav_put_float_array(buf, 188, pos_yaw, 5);
193 _mav_put_float_array(buf, 208, vel_yaw, 5);
194 _mav_put_uint16_t_array(buf, 228, command, 5);
195 memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_TRAJECTORY_REPRESENTATION_WAYPOINTS_LEN);
196#else
197 mavlink_trajectory_representation_waypoints_t packet;
198 packet.time_usec = time_usec;
199 packet.valid_points = valid_points;
200 mav_array_memcpy(packet.pos_x, pos_x, sizeof(float)*5);
201 mav_array_memcpy(packet.pos_y, pos_y, sizeof(float)*5);
202 mav_array_memcpy(packet.pos_z, pos_z, sizeof(float)*5);
203 mav_array_memcpy(packet.vel_x, vel_x, sizeof(float)*5);
204 mav_array_memcpy(packet.vel_y, vel_y, sizeof(float)*5);
205 mav_array_memcpy(packet.vel_z, vel_z, sizeof(float)*5);
206 mav_array_memcpy(packet.acc_x, acc_x, sizeof(float)*5);
207 mav_array_memcpy(packet.acc_y, acc_y, sizeof(float)*5);
208 mav_array_memcpy(packet.acc_z, acc_z, sizeof(float)*5);
209 mav_array_memcpy(packet.pos_yaw, pos_yaw, sizeof(float)*5);
210 mav_array_memcpy(packet.vel_yaw, vel_yaw, sizeof(float)*5);
211 mav_array_memcpy(packet.command, command, sizeof(uint16_t)*5);
212 memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_TRAJECTORY_REPRESENTATION_WAYPOINTS_LEN);
213#endif
214
216#if MAVLINK_CRC_EXTRA
217 return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_TRAJECTORY_REPRESENTATION_WAYPOINTS_MIN_LEN, MAVLINK_MSG_ID_TRAJECTORY_REPRESENTATION_WAYPOINTS_LEN, MAVLINK_MSG_ID_TRAJECTORY_REPRESENTATION_WAYPOINTS_CRC);
218#else
219 return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_TRAJECTORY_REPRESENTATION_WAYPOINTS_MIN_LEN, MAVLINK_MSG_ID_TRAJECTORY_REPRESENTATION_WAYPOINTS_LEN);
220#endif
221}
222
223/**
224 * @brief Pack a trajectory_representation_waypoints message on a channel
225 * @param system_id ID of this system
226 * @param component_id ID of this component (e.g. 200 for IMU)
227 * @param chan The MAVLink channel this message will be sent over
228 * @param msg The MAVLink message to compress the data into
229 * @param time_usec [us] Timestamp (UNIX Epoch time or time since system boot). The receiving end can infer timestamp format (since 1.1.1970 or since system boot) by checking for the magnitude of the number.
230 * @param valid_points Number of valid points (up-to 5 waypoints are possible)
231 * @param pos_x [m] X-coordinate of waypoint, set to NaN if not being used
232 * @param pos_y [m] Y-coordinate of waypoint, set to NaN if not being used
233 * @param pos_z [m] Z-coordinate of waypoint, set to NaN if not being used
234 * @param vel_x [m/s] X-velocity of waypoint, set to NaN if not being used
235 * @param vel_y [m/s] Y-velocity of waypoint, set to NaN if not being used
236 * @param vel_z [m/s] Z-velocity of waypoint, set to NaN if not being used
237 * @param acc_x [m/s/s] X-acceleration of waypoint, set to NaN if not being used
238 * @param acc_y [m/s/s] Y-acceleration of waypoint, set to NaN if not being used
239 * @param acc_z [m/s/s] Z-acceleration of waypoint, set to NaN if not being used
240 * @param pos_yaw [rad] Yaw angle, set to NaN if not being used
241 * @param vel_yaw [rad/s] Yaw rate, set to NaN if not being used
242 * @param command MAV_CMD command id of waypoint, set to UINT16_MAX if not being used.
243 * @return length of the message in bytes (excluding serial stream start sign)
244 */
245static inline uint16_t mavlink_msg_trajectory_representation_waypoints_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan,
246 mavlink_message_t* msg,
247 uint64_t time_usec,uint8_t valid_points,const float *pos_x,const float *pos_y,const float *pos_z,const float *vel_x,const float *vel_y,const float *vel_z,const float *acc_x,const float *acc_y,const float *acc_z,const float *pos_yaw,const float *vel_yaw,const uint16_t *command)
248{
249#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
251 _mav_put_uint64_t(buf, 0, time_usec);
252 _mav_put_uint8_t(buf, 238, valid_points);
253 _mav_put_float_array(buf, 8, pos_x, 5);
254 _mav_put_float_array(buf, 28, pos_y, 5);
255 _mav_put_float_array(buf, 48, pos_z, 5);
256 _mav_put_float_array(buf, 68, vel_x, 5);
257 _mav_put_float_array(buf, 88, vel_y, 5);
258 _mav_put_float_array(buf, 108, vel_z, 5);
259 _mav_put_float_array(buf, 128, acc_x, 5);
260 _mav_put_float_array(buf, 148, acc_y, 5);
261 _mav_put_float_array(buf, 168, acc_z, 5);
262 _mav_put_float_array(buf, 188, pos_yaw, 5);
263 _mav_put_float_array(buf, 208, vel_yaw, 5);
264 _mav_put_uint16_t_array(buf, 228, command, 5);
265 memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_TRAJECTORY_REPRESENTATION_WAYPOINTS_LEN);
266#else
267 mavlink_trajectory_representation_waypoints_t packet;
268 packet.time_usec = time_usec;
269 packet.valid_points = valid_points;
270 mav_array_memcpy(packet.pos_x, pos_x, sizeof(float)*5);
271 mav_array_memcpy(packet.pos_y, pos_y, sizeof(float)*5);
272 mav_array_memcpy(packet.pos_z, pos_z, sizeof(float)*5);
273 mav_array_memcpy(packet.vel_x, vel_x, sizeof(float)*5);
274 mav_array_memcpy(packet.vel_y, vel_y, sizeof(float)*5);
275 mav_array_memcpy(packet.vel_z, vel_z, sizeof(float)*5);
276 mav_array_memcpy(packet.acc_x, acc_x, sizeof(float)*5);
277 mav_array_memcpy(packet.acc_y, acc_y, sizeof(float)*5);
278 mav_array_memcpy(packet.acc_z, acc_z, sizeof(float)*5);
279 mav_array_memcpy(packet.pos_yaw, pos_yaw, sizeof(float)*5);
280 mav_array_memcpy(packet.vel_yaw, vel_yaw, sizeof(float)*5);
281 mav_array_memcpy(packet.command, command, sizeof(uint16_t)*5);
282 memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_TRAJECTORY_REPRESENTATION_WAYPOINTS_LEN);
283#endif
284
287}
288
289/**
290 * @brief Encode a trajectory_representation_waypoints struct
291 *
292 * @param system_id ID of this system
293 * @param component_id ID of this component (e.g. 200 for IMU)
294 * @param msg The MAVLink message to compress the data into
295 * @param trajectory_representation_waypoints C-struct to read the message contents from
296 */
297static inline uint16_t mavlink_msg_trajectory_representation_waypoints_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_trajectory_representation_waypoints_t* trajectory_representation_waypoints)
298{
299 return mavlink_msg_trajectory_representation_waypoints_pack(system_id, component_id, msg, trajectory_representation_waypoints->time_usec, trajectory_representation_waypoints->valid_points, trajectory_representation_waypoints->pos_x, trajectory_representation_waypoints->pos_y, trajectory_representation_waypoints->pos_z, trajectory_representation_waypoints->vel_x, trajectory_representation_waypoints->vel_y, trajectory_representation_waypoints->vel_z, trajectory_representation_waypoints->acc_x, trajectory_representation_waypoints->acc_y, trajectory_representation_waypoints->acc_z, trajectory_representation_waypoints->pos_yaw, trajectory_representation_waypoints->vel_yaw, trajectory_representation_waypoints->command);
300}
301
302/**
303 * @brief Encode a trajectory_representation_waypoints struct on a channel
304 *
305 * @param system_id ID of this system
306 * @param component_id ID of this component (e.g. 200 for IMU)
307 * @param chan The MAVLink channel this message will be sent over
308 * @param msg The MAVLink message to compress the data into
309 * @param trajectory_representation_waypoints C-struct to read the message contents from
310 */
311static inline uint16_t mavlink_msg_trajectory_representation_waypoints_encode_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, const mavlink_trajectory_representation_waypoints_t* trajectory_representation_waypoints)
312{
313 return mavlink_msg_trajectory_representation_waypoints_pack_chan(system_id, component_id, chan, msg, trajectory_representation_waypoints->time_usec, trajectory_representation_waypoints->valid_points, trajectory_representation_waypoints->pos_x, trajectory_representation_waypoints->pos_y, trajectory_representation_waypoints->pos_z, trajectory_representation_waypoints->vel_x, trajectory_representation_waypoints->vel_y, trajectory_representation_waypoints->vel_z, trajectory_representation_waypoints->acc_x, trajectory_representation_waypoints->acc_y, trajectory_representation_waypoints->acc_z, trajectory_representation_waypoints->pos_yaw, trajectory_representation_waypoints->vel_yaw, trajectory_representation_waypoints->command);
314}
315
316/**
317 * @brief Encode a trajectory_representation_waypoints struct with provided status structure
318 *
319 * @param system_id ID of this system
320 * @param component_id ID of this component (e.g. 200 for IMU)
321 * @param status MAVLink status structure
322 * @param msg The MAVLink message to compress the data into
323 * @param trajectory_representation_waypoints C-struct to read the message contents from
324 */
325static inline uint16_t mavlink_msg_trajectory_representation_waypoints_encode_status(uint8_t system_id, uint8_t component_id, mavlink_status_t* _status, mavlink_message_t* msg, const mavlink_trajectory_representation_waypoints_t* trajectory_representation_waypoints)
326{
327 return mavlink_msg_trajectory_representation_waypoints_pack_status(system_id, component_id, _status, msg, trajectory_representation_waypoints->time_usec, trajectory_representation_waypoints->valid_points, trajectory_representation_waypoints->pos_x, trajectory_representation_waypoints->pos_y, trajectory_representation_waypoints->pos_z, trajectory_representation_waypoints->vel_x, trajectory_representation_waypoints->vel_y, trajectory_representation_waypoints->vel_z, trajectory_representation_waypoints->acc_x, trajectory_representation_waypoints->acc_y, trajectory_representation_waypoints->acc_z, trajectory_representation_waypoints->pos_yaw, trajectory_representation_waypoints->vel_yaw, trajectory_representation_waypoints->command);
328}
329
330/**
331 * @brief Send a trajectory_representation_waypoints message
332 * @param chan MAVLink channel to send the message
333 *
334 * @param time_usec [us] Timestamp (UNIX Epoch time or time since system boot). The receiving end can infer timestamp format (since 1.1.1970 or since system boot) by checking for the magnitude of the number.
335 * @param valid_points Number of valid points (up-to 5 waypoints are possible)
336 * @param pos_x [m] X-coordinate of waypoint, set to NaN if not being used
337 * @param pos_y [m] Y-coordinate of waypoint, set to NaN if not being used
338 * @param pos_z [m] Z-coordinate of waypoint, set to NaN if not being used
339 * @param vel_x [m/s] X-velocity of waypoint, set to NaN if not being used
340 * @param vel_y [m/s] Y-velocity of waypoint, set to NaN if not being used
341 * @param vel_z [m/s] Z-velocity of waypoint, set to NaN if not being used
342 * @param acc_x [m/s/s] X-acceleration of waypoint, set to NaN if not being used
343 * @param acc_y [m/s/s] Y-acceleration of waypoint, set to NaN if not being used
344 * @param acc_z [m/s/s] Z-acceleration of waypoint, set to NaN if not being used
345 * @param pos_yaw [rad] Yaw angle, set to NaN if not being used
346 * @param vel_yaw [rad/s] Yaw rate, set to NaN if not being used
347 * @param command MAV_CMD command id of waypoint, set to UINT16_MAX if not being used.
348 */
349#ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS
350
351static inline void mavlink_msg_trajectory_representation_waypoints_send(mavlink_channel_t chan, uint64_t time_usec, uint8_t valid_points, const float *pos_x, const float *pos_y, const float *pos_z, const float *vel_x, const float *vel_y, const float *vel_z, const float *acc_x, const float *acc_y, const float *acc_z, const float *pos_yaw, const float *vel_yaw, const uint16_t *command)
352{
353#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
354 char buf[MAVLINK_MSG_ID_TRAJECTORY_REPRESENTATION_WAYPOINTS_LEN];
355 _mav_put_uint64_t(buf, 0, time_usec);
356 _mav_put_uint8_t(buf, 238, valid_points);
357 _mav_put_float_array(buf, 8, pos_x, 5);
358 _mav_put_float_array(buf, 28, pos_y, 5);
359 _mav_put_float_array(buf, 48, pos_z, 5);
360 _mav_put_float_array(buf, 68, vel_x, 5);
361 _mav_put_float_array(buf, 88, vel_y, 5);
362 _mav_put_float_array(buf, 108, vel_z, 5);
363 _mav_put_float_array(buf, 128, acc_x, 5);
364 _mav_put_float_array(buf, 148, acc_y, 5);
365 _mav_put_float_array(buf, 168, acc_z, 5);
366 _mav_put_float_array(buf, 188, pos_yaw, 5);
367 _mav_put_float_array(buf, 208, vel_yaw, 5);
368 _mav_put_uint16_t_array(buf, 228, command, 5);
369 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_TRAJECTORY_REPRESENTATION_WAYPOINTS, buf, MAVLINK_MSG_ID_TRAJECTORY_REPRESENTATION_WAYPOINTS_MIN_LEN, MAVLINK_MSG_ID_TRAJECTORY_REPRESENTATION_WAYPOINTS_LEN, MAVLINK_MSG_ID_TRAJECTORY_REPRESENTATION_WAYPOINTS_CRC);
370#else
371 mavlink_trajectory_representation_waypoints_t packet;
372 packet.time_usec = time_usec;
373 packet.valid_points = valid_points;
374 mav_array_memcpy(packet.pos_x, pos_x, sizeof(float)*5);
375 mav_array_memcpy(packet.pos_y, pos_y, sizeof(float)*5);
376 mav_array_memcpy(packet.pos_z, pos_z, sizeof(float)*5);
377 mav_array_memcpy(packet.vel_x, vel_x, sizeof(float)*5);
378 mav_array_memcpy(packet.vel_y, vel_y, sizeof(float)*5);
379 mav_array_memcpy(packet.vel_z, vel_z, sizeof(float)*5);
380 mav_array_memcpy(packet.acc_x, acc_x, sizeof(float)*5);
381 mav_array_memcpy(packet.acc_y, acc_y, sizeof(float)*5);
382 mav_array_memcpy(packet.acc_z, acc_z, sizeof(float)*5);
383 mav_array_memcpy(packet.pos_yaw, pos_yaw, sizeof(float)*5);
384 mav_array_memcpy(packet.vel_yaw, vel_yaw, sizeof(float)*5);
385 mav_array_memcpy(packet.command, command, sizeof(uint16_t)*5);
386 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_TRAJECTORY_REPRESENTATION_WAYPOINTS, (const char *)&packet, MAVLINK_MSG_ID_TRAJECTORY_REPRESENTATION_WAYPOINTS_MIN_LEN, MAVLINK_MSG_ID_TRAJECTORY_REPRESENTATION_WAYPOINTS_LEN, MAVLINK_MSG_ID_TRAJECTORY_REPRESENTATION_WAYPOINTS_CRC);
387#endif
388}
389
390/**
391 * @brief Send a trajectory_representation_waypoints message
392 * @param chan MAVLink channel to send the message
393 * @param struct The MAVLink struct to serialize
394 */
395static inline void mavlink_msg_trajectory_representation_waypoints_send_struct(mavlink_channel_t chan, const mavlink_trajectory_representation_waypoints_t* trajectory_representation_waypoints)
396{
397#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
398 mavlink_msg_trajectory_representation_waypoints_send(chan, trajectory_representation_waypoints->time_usec, trajectory_representation_waypoints->valid_points, trajectory_representation_waypoints->pos_x, trajectory_representation_waypoints->pos_y, trajectory_representation_waypoints->pos_z, trajectory_representation_waypoints->vel_x, trajectory_representation_waypoints->vel_y, trajectory_representation_waypoints->vel_z, trajectory_representation_waypoints->acc_x, trajectory_representation_waypoints->acc_y, trajectory_representation_waypoints->acc_z, trajectory_representation_waypoints->pos_yaw, trajectory_representation_waypoints->vel_yaw, trajectory_representation_waypoints->command);
399#else
400 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_TRAJECTORY_REPRESENTATION_WAYPOINTS, (const char *)trajectory_representation_waypoints, MAVLINK_MSG_ID_TRAJECTORY_REPRESENTATION_WAYPOINTS_MIN_LEN, MAVLINK_MSG_ID_TRAJECTORY_REPRESENTATION_WAYPOINTS_LEN, MAVLINK_MSG_ID_TRAJECTORY_REPRESENTATION_WAYPOINTS_CRC);
401#endif
402}
403
404#if MAVLINK_MSG_ID_TRAJECTORY_REPRESENTATION_WAYPOINTS_LEN <= MAVLINK_MAX_PAYLOAD_LEN
405/*
406 This variant of _send() can be used to save stack space by reusing
407 memory from the receive buffer. The caller provides a
408 mavlink_message_t which is the size of a full mavlink message. This
409 is usually the receive buffer for the channel, and allows a reply to an
410 incoming message with minimum stack space usage.
411 */
412static inline void mavlink_msg_trajectory_representation_waypoints_send_buf(mavlink_message_t *msgbuf, mavlink_channel_t chan, uint64_t time_usec, uint8_t valid_points, const float *pos_x, const float *pos_y, const float *pos_z, const float *vel_x, const float *vel_y, const float *vel_z, const float *acc_x, const float *acc_y, const float *acc_z, const float *pos_yaw, const float *vel_yaw, const uint16_t *command)
413{
414#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
415 char *buf = (char *)msgbuf;
416 _mav_put_uint64_t(buf, 0, time_usec);
417 _mav_put_uint8_t(buf, 238, valid_points);
418 _mav_put_float_array(buf, 8, pos_x, 5);
419 _mav_put_float_array(buf, 28, pos_y, 5);
420 _mav_put_float_array(buf, 48, pos_z, 5);
421 _mav_put_float_array(buf, 68, vel_x, 5);
422 _mav_put_float_array(buf, 88, vel_y, 5);
423 _mav_put_float_array(buf, 108, vel_z, 5);
424 _mav_put_float_array(buf, 128, acc_x, 5);
425 _mav_put_float_array(buf, 148, acc_y, 5);
426 _mav_put_float_array(buf, 168, acc_z, 5);
427 _mav_put_float_array(buf, 188, pos_yaw, 5);
428 _mav_put_float_array(buf, 208, vel_yaw, 5);
429 _mav_put_uint16_t_array(buf, 228, command, 5);
430 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_TRAJECTORY_REPRESENTATION_WAYPOINTS, buf, MAVLINK_MSG_ID_TRAJECTORY_REPRESENTATION_WAYPOINTS_MIN_LEN, MAVLINK_MSG_ID_TRAJECTORY_REPRESENTATION_WAYPOINTS_LEN, MAVLINK_MSG_ID_TRAJECTORY_REPRESENTATION_WAYPOINTS_CRC);
431#else
432 mavlink_trajectory_representation_waypoints_t *packet = (mavlink_trajectory_representation_waypoints_t *)msgbuf;
433 packet->time_usec = time_usec;
434 packet->valid_points = valid_points;
435 mav_array_memcpy(packet->pos_x, pos_x, sizeof(float)*5);
436 mav_array_memcpy(packet->pos_y, pos_y, sizeof(float)*5);
437 mav_array_memcpy(packet->pos_z, pos_z, sizeof(float)*5);
438 mav_array_memcpy(packet->vel_x, vel_x, sizeof(float)*5);
439 mav_array_memcpy(packet->vel_y, vel_y, sizeof(float)*5);
440 mav_array_memcpy(packet->vel_z, vel_z, sizeof(float)*5);
441 mav_array_memcpy(packet->acc_x, acc_x, sizeof(float)*5);
442 mav_array_memcpy(packet->acc_y, acc_y, sizeof(float)*5);
443 mav_array_memcpy(packet->acc_z, acc_z, sizeof(float)*5);
444 mav_array_memcpy(packet->pos_yaw, pos_yaw, sizeof(float)*5);
445 mav_array_memcpy(packet->vel_yaw, vel_yaw, sizeof(float)*5);
446 mav_array_memcpy(packet->command, command, sizeof(uint16_t)*5);
447 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_TRAJECTORY_REPRESENTATION_WAYPOINTS, (const char *)packet, MAVLINK_MSG_ID_TRAJECTORY_REPRESENTATION_WAYPOINTS_MIN_LEN, MAVLINK_MSG_ID_TRAJECTORY_REPRESENTATION_WAYPOINTS_LEN, MAVLINK_MSG_ID_TRAJECTORY_REPRESENTATION_WAYPOINTS_CRC);
448#endif
449}
450#endif
451
452#endif
453
454// MESSAGE TRAJECTORY_REPRESENTATION_WAYPOINTS UNPACKING
455
456
457/**
458 * @brief Get field time_usec from trajectory_representation_waypoints message
459 *
460 * @return [us] Timestamp (UNIX Epoch time or time since system boot). The receiving end can infer timestamp format (since 1.1.1970 or since system boot) by checking for the magnitude of the number.
461 */
462static inline uint64_t mavlink_msg_trajectory_representation_waypoints_get_time_usec(const mavlink_message_t* msg)
463{
464 return _MAV_RETURN_uint64_t(msg, 0);
465}
466
467/**
468 * @brief Get field valid_points from trajectory_representation_waypoints message
469 *
470 * @return Number of valid points (up-to 5 waypoints are possible)
471 */
472static inline uint8_t mavlink_msg_trajectory_representation_waypoints_get_valid_points(const mavlink_message_t* msg)
473{
474 return _MAV_RETURN_uint8_t(msg, 238);
475}
476
477/**
478 * @brief Get field pos_x from trajectory_representation_waypoints message
479 *
480 * @return [m] X-coordinate of waypoint, set to NaN if not being used
481 */
482static inline uint16_t mavlink_msg_trajectory_representation_waypoints_get_pos_x(const mavlink_message_t* msg, float *pos_x)
483{
484 return _MAV_RETURN_float_array(msg, pos_x, 5, 8);
485}
486
487/**
488 * @brief Get field pos_y from trajectory_representation_waypoints message
489 *
490 * @return [m] Y-coordinate of waypoint, set to NaN if not being used
491 */
492static inline uint16_t mavlink_msg_trajectory_representation_waypoints_get_pos_y(const mavlink_message_t* msg, float *pos_y)
493{
494 return _MAV_RETURN_float_array(msg, pos_y, 5, 28);
495}
496
497/**
498 * @brief Get field pos_z from trajectory_representation_waypoints message
499 *
500 * @return [m] Z-coordinate of waypoint, set to NaN if not being used
501 */
502static inline uint16_t mavlink_msg_trajectory_representation_waypoints_get_pos_z(const mavlink_message_t* msg, float *pos_z)
503{
504 return _MAV_RETURN_float_array(msg, pos_z, 5, 48);
505}
506
507/**
508 * @brief Get field vel_x from trajectory_representation_waypoints message
509 *
510 * @return [m/s] X-velocity of waypoint, set to NaN if not being used
511 */
512static inline uint16_t mavlink_msg_trajectory_representation_waypoints_get_vel_x(const mavlink_message_t* msg, float *vel_x)
513{
514 return _MAV_RETURN_float_array(msg, vel_x, 5, 68);
515}
516
517/**
518 * @brief Get field vel_y from trajectory_representation_waypoints message
519 *
520 * @return [m/s] Y-velocity of waypoint, set to NaN if not being used
521 */
522static inline uint16_t mavlink_msg_trajectory_representation_waypoints_get_vel_y(const mavlink_message_t* msg, float *vel_y)
523{
524 return _MAV_RETURN_float_array(msg, vel_y, 5, 88);
525}
526
527/**
528 * @brief Get field vel_z from trajectory_representation_waypoints message
529 *
530 * @return [m/s] Z-velocity of waypoint, set to NaN if not being used
531 */
532static inline uint16_t mavlink_msg_trajectory_representation_waypoints_get_vel_z(const mavlink_message_t* msg, float *vel_z)
533{
534 return _MAV_RETURN_float_array(msg, vel_z, 5, 108);
535}
536
537/**
538 * @brief Get field acc_x from trajectory_representation_waypoints message
539 *
540 * @return [m/s/s] X-acceleration of waypoint, set to NaN if not being used
541 */
542static inline uint16_t mavlink_msg_trajectory_representation_waypoints_get_acc_x(const mavlink_message_t* msg, float *acc_x)
543{
544 return _MAV_RETURN_float_array(msg, acc_x, 5, 128);
545}
546
547/**
548 * @brief Get field acc_y from trajectory_representation_waypoints message
549 *
550 * @return [m/s/s] Y-acceleration of waypoint, set to NaN if not being used
551 */
552static inline uint16_t mavlink_msg_trajectory_representation_waypoints_get_acc_y(const mavlink_message_t* msg, float *acc_y)
553{
554 return _MAV_RETURN_float_array(msg, acc_y, 5, 148);
555}
556
557/**
558 * @brief Get field acc_z from trajectory_representation_waypoints message
559 *
560 * @return [m/s/s] Z-acceleration of waypoint, set to NaN if not being used
561 */
562static inline uint16_t mavlink_msg_trajectory_representation_waypoints_get_acc_z(const mavlink_message_t* msg, float *acc_z)
563{
564 return _MAV_RETURN_float_array(msg, acc_z, 5, 168);
565}
566
567/**
568 * @brief Get field pos_yaw from trajectory_representation_waypoints message
569 *
570 * @return [rad] Yaw angle, set to NaN if not being used
571 */
572static inline uint16_t mavlink_msg_trajectory_representation_waypoints_get_pos_yaw(const mavlink_message_t* msg, float *pos_yaw)
573{
574 return _MAV_RETURN_float_array(msg, pos_yaw, 5, 188);
575}
576
577/**
578 * @brief Get field vel_yaw from trajectory_representation_waypoints message
579 *
580 * @return [rad/s] Yaw rate, set to NaN if not being used
581 */
582static inline uint16_t mavlink_msg_trajectory_representation_waypoints_get_vel_yaw(const mavlink_message_t* msg, float *vel_yaw)
583{
584 return _MAV_RETURN_float_array(msg, vel_yaw, 5, 208);
585}
586
587/**
588 * @brief Get field command from trajectory_representation_waypoints message
589 *
590 * @return MAV_CMD command id of waypoint, set to UINT16_MAX if not being used.
591 */
592static inline uint16_t mavlink_msg_trajectory_representation_waypoints_get_command(const mavlink_message_t* msg, uint16_t *command)
593{
594 return _MAV_RETURN_uint16_t_array(msg, command, 5, 228);
595}
596
597/**
598 * @brief Decode a trajectory_representation_waypoints message into a struct
599 *
600 * @param msg The message to decode
601 * @param trajectory_representation_waypoints C-struct to decode the message contents into
602 */
603static inline void mavlink_msg_trajectory_representation_waypoints_decode(const mavlink_message_t* msg, mavlink_trajectory_representation_waypoints_t* trajectory_representation_waypoints)
604{
605#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
606 trajectory_representation_waypoints->time_usec = mavlink_msg_trajectory_representation_waypoints_get_time_usec(msg);
607 mavlink_msg_trajectory_representation_waypoints_get_pos_x(msg, trajectory_representation_waypoints->pos_x);
608 mavlink_msg_trajectory_representation_waypoints_get_pos_y(msg, trajectory_representation_waypoints->pos_y);
609 mavlink_msg_trajectory_representation_waypoints_get_pos_z(msg, trajectory_representation_waypoints->pos_z);
610 mavlink_msg_trajectory_representation_waypoints_get_vel_x(msg, trajectory_representation_waypoints->vel_x);
611 mavlink_msg_trajectory_representation_waypoints_get_vel_y(msg, trajectory_representation_waypoints->vel_y);
612 mavlink_msg_trajectory_representation_waypoints_get_vel_z(msg, trajectory_representation_waypoints->vel_z);
613 mavlink_msg_trajectory_representation_waypoints_get_acc_x(msg, trajectory_representation_waypoints->acc_x);
614 mavlink_msg_trajectory_representation_waypoints_get_acc_y(msg, trajectory_representation_waypoints->acc_y);
615 mavlink_msg_trajectory_representation_waypoints_get_acc_z(msg, trajectory_representation_waypoints->acc_z);
616 mavlink_msg_trajectory_representation_waypoints_get_pos_yaw(msg, trajectory_representation_waypoints->pos_yaw);
617 mavlink_msg_trajectory_representation_waypoints_get_vel_yaw(msg, trajectory_representation_waypoints->vel_yaw);
618 mavlink_msg_trajectory_representation_waypoints_get_command(msg, trajectory_representation_waypoints->command);
619 trajectory_representation_waypoints->valid_points = mavlink_msg_trajectory_representation_waypoints_get_valid_points(msg);
620#else
621 uint8_t len = msg->len < MAVLINK_MSG_ID_TRAJECTORY_REPRESENTATION_WAYPOINTS_LEN? msg->len : MAVLINK_MSG_ID_TRAJECTORY_REPRESENTATION_WAYPOINTS_LEN;
622 memset(trajectory_representation_waypoints, 0, MAVLINK_MSG_ID_TRAJECTORY_REPRESENTATION_WAYPOINTS_LEN);
623 memcpy(trajectory_representation_waypoints, _MAV_PAYLOAD(msg), len);
624#endif
625}