mavlink_msg_image_triggered.h 12.5 KB
Newer Older
James Goppert's avatar
James Goppert committed
1 2
// MESSAGE IMAGE_TRIGGERED PACKING

lm's avatar
lm committed
3
#define MAVLINK_MSG_ID_IMAGE_TRIGGERED 152
James Goppert's avatar
James Goppert committed
4

lm's avatar
lm committed
5
typedef struct __mavlink_image_triggered_t
James Goppert's avatar
James Goppert committed
6
{
lm's avatar
lm committed
7 8 9 10 11 12 13 14 15 16 17 18
 uint64_t timestamp; ///< Timestamp
 uint32_t seq; ///< IMU seq
 float roll; ///< Roll angle in rad
 float pitch; ///< Pitch angle in rad
 float yaw; ///< Yaw angle in rad
 float local_z; ///< Local frame Z coordinate (height over ground)
 float lat; ///< GPS X coordinate
 float lon; ///< GPS Y coordinate
 float alt; ///< Global frame altitude
 float ground_x; ///< Ground truth X
 float ground_y; ///< Ground truth Y
 float ground_z; ///< Ground truth Z
James Goppert's avatar
James Goppert committed
19 20
} mavlink_image_triggered_t;

lm's avatar
lm committed
21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44
#define MAVLINK_MSG_ID_IMAGE_TRIGGERED_LEN 52
#define MAVLINK_MSG_ID_152_LEN 52



#define MAVLINK_MESSAGE_INFO_IMAGE_TRIGGERED { \
	"IMAGE_TRIGGERED", \
	12, \
	{  { "timestamp", MAVLINK_TYPE_UINT64_T, 0, 0, offsetof(mavlink_image_triggered_t, timestamp) }, \
         { "seq", MAVLINK_TYPE_UINT32_T, 0, 8, offsetof(mavlink_image_triggered_t, seq) }, \
         { "roll", MAVLINK_TYPE_FLOAT, 0, 12, offsetof(mavlink_image_triggered_t, roll) }, \
         { "pitch", MAVLINK_TYPE_FLOAT, 0, 16, offsetof(mavlink_image_triggered_t, pitch) }, \
         { "yaw", MAVLINK_TYPE_FLOAT, 0, 20, offsetof(mavlink_image_triggered_t, yaw) }, \
         { "local_z", MAVLINK_TYPE_FLOAT, 0, 24, offsetof(mavlink_image_triggered_t, local_z) }, \
         { "lat", MAVLINK_TYPE_FLOAT, 0, 28, offsetof(mavlink_image_triggered_t, lat) }, \
         { "lon", MAVLINK_TYPE_FLOAT, 0, 32, offsetof(mavlink_image_triggered_t, lon) }, \
         { "alt", MAVLINK_TYPE_FLOAT, 0, 36, offsetof(mavlink_image_triggered_t, alt) }, \
         { "ground_x", MAVLINK_TYPE_FLOAT, 0, 40, offsetof(mavlink_image_triggered_t, ground_x) }, \
         { "ground_y", MAVLINK_TYPE_FLOAT, 0, 44, offsetof(mavlink_image_triggered_t, ground_y) }, \
         { "ground_z", MAVLINK_TYPE_FLOAT, 0, 48, offsetof(mavlink_image_triggered_t, ground_z) }, \
         } \
}


James Goppert's avatar
James Goppert committed
45 46 47 48 49 50 51 52 53 54 55 56 57 58 59
/**
 * @brief Pack a image_triggered message
 * @param system_id ID of this system
 * @param component_id ID of this component (e.g. 200 for IMU)
 * @param msg The MAVLink message to compress the data into
 *
 * @param timestamp Timestamp
 * @param seq IMU seq
 * @param roll Roll angle in rad
 * @param pitch Pitch angle in rad
 * @param yaw Yaw angle in rad
 * @param local_z Local frame Z coordinate (height over ground)
 * @param lat GPS X coordinate
 * @param lon GPS Y coordinate
 * @param alt Global frame altitude
LM's avatar
LM committed
60 61 62
 * @param ground_x Ground truth X
 * @param ground_y Ground truth Y
 * @param ground_z Ground truth Z
James Goppert's avatar
James Goppert committed
63 64
 * @return length of the message in bytes (excluding serial stream start sign)
 */
lm's avatar
lm committed
65 66
static inline uint16_t mavlink_msg_image_triggered_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg,
						       uint64_t timestamp, uint32_t seq, float roll, float pitch, float yaw, float local_z, float lat, float lon, float alt, float ground_x, float ground_y, float ground_z)
James Goppert's avatar
James Goppert committed
67
{
LM's avatar
LM committed
68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100
#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
	char buf[52];
	_mav_put_uint64_t(buf, 0, timestamp);
	_mav_put_uint32_t(buf, 8, seq);
	_mav_put_float(buf, 12, roll);
	_mav_put_float(buf, 16, pitch);
	_mav_put_float(buf, 20, yaw);
	_mav_put_float(buf, 24, local_z);
	_mav_put_float(buf, 28, lat);
	_mav_put_float(buf, 32, lon);
	_mav_put_float(buf, 36, alt);
	_mav_put_float(buf, 40, ground_x);
	_mav_put_float(buf, 44, ground_y);
	_mav_put_float(buf, 48, ground_z);

        memcpy(_MAV_PAYLOAD(msg), buf, 52);
#else
	mavlink_image_triggered_t packet;
	packet.timestamp = timestamp;
	packet.seq = seq;
	packet.roll = roll;
	packet.pitch = pitch;
	packet.yaw = yaw;
	packet.local_z = local_z;
	packet.lat = lat;
	packet.lon = lon;
	packet.alt = alt;
	packet.ground_x = ground_x;
	packet.ground_y = ground_y;
	packet.ground_z = ground_z;

        memcpy(_MAV_PAYLOAD(msg), &packet, 52);
#endif
lm's avatar
lm committed
101

LM's avatar
LM committed
102
	msg->msgid = MAVLINK_MSG_ID_IMAGE_TRIGGERED;
lm's avatar
lm committed
103
	return mavlink_finalize_message(msg, system_id, component_id, 52, 86);
James Goppert's avatar
James Goppert committed
104 105 106
}

/**
lm's avatar
lm committed
107
 * @brief Pack a image_triggered message on a channel
James Goppert's avatar
James Goppert committed
108 109 110 111 112 113 114 115 116 117 118 119 120
 * @param system_id ID of this system
 * @param component_id ID of this component (e.g. 200 for IMU)
 * @param chan The MAVLink channel this message was sent over
 * @param msg The MAVLink message to compress the data into
 * @param timestamp Timestamp
 * @param seq IMU seq
 * @param roll Roll angle in rad
 * @param pitch Pitch angle in rad
 * @param yaw Yaw angle in rad
 * @param local_z Local frame Z coordinate (height over ground)
 * @param lat GPS X coordinate
 * @param lon GPS Y coordinate
 * @param alt Global frame altitude
LM's avatar
LM committed
121 122 123
 * @param ground_x Ground truth X
 * @param ground_y Ground truth Y
 * @param ground_z Ground truth Z
James Goppert's avatar
James Goppert committed
124 125
 * @return length of the message in bytes (excluding serial stream start sign)
 */
lm's avatar
lm committed
126 127 128 129
static inline uint16_t mavlink_msg_image_triggered_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan,
							   mavlink_message_t* msg,
						           uint64_t timestamp,uint32_t seq,float roll,float pitch,float yaw,float local_z,float lat,float lon,float alt,float ground_x,float ground_y,float ground_z)
{
LM's avatar
LM committed
130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162
#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
	char buf[52];
	_mav_put_uint64_t(buf, 0, timestamp);
	_mav_put_uint32_t(buf, 8, seq);
	_mav_put_float(buf, 12, roll);
	_mav_put_float(buf, 16, pitch);
	_mav_put_float(buf, 20, yaw);
	_mav_put_float(buf, 24, local_z);
	_mav_put_float(buf, 28, lat);
	_mav_put_float(buf, 32, lon);
	_mav_put_float(buf, 36, alt);
	_mav_put_float(buf, 40, ground_x);
	_mav_put_float(buf, 44, ground_y);
	_mav_put_float(buf, 48, ground_z);

        memcpy(_MAV_PAYLOAD(msg), buf, 52);
#else
	mavlink_image_triggered_t packet;
	packet.timestamp = timestamp;
	packet.seq = seq;
	packet.roll = roll;
	packet.pitch = pitch;
	packet.yaw = yaw;
	packet.local_z = local_z;
	packet.lat = lat;
	packet.lon = lon;
	packet.alt = alt;
	packet.ground_x = ground_x;
	packet.ground_y = ground_y;
	packet.ground_z = ground_z;

        memcpy(_MAV_PAYLOAD(msg), &packet, 52);
#endif
lm's avatar
lm committed
163

LM's avatar
LM committed
164
	msg->msgid = MAVLINK_MSG_ID_IMAGE_TRIGGERED;
lm's avatar
lm committed
165 166 167
	return mavlink_finalize_message_chan(msg, system_id, component_id, chan, 52, 86);
}

James Goppert's avatar
James Goppert committed
168 169 170 171 172 173 174 175 176 177
/**
 * @brief Encode a image_triggered struct into a message
 *
 * @param system_id ID of this system
 * @param component_id ID of this component (e.g. 200 for IMU)
 * @param msg The MAVLink message to compress the data into
 * @param image_triggered C-struct to read the message contents from
 */
static inline uint16_t mavlink_msg_image_triggered_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_image_triggered_t* image_triggered)
{
LM's avatar
LM committed
178
	return mavlink_msg_image_triggered_pack(system_id, component_id, msg, image_triggered->timestamp, image_triggered->seq, image_triggered->roll, image_triggered->pitch, image_triggered->yaw, image_triggered->local_z, image_triggered->lat, image_triggered->lon, image_triggered->alt, image_triggered->ground_x, image_triggered->ground_y, image_triggered->ground_z);
James Goppert's avatar
James Goppert committed
179 180 181 182 183 184 185 186 187 188 189 190 191 192 193
}

/**
 * @brief Send a image_triggered message
 * @param chan MAVLink channel to send the message
 *
 * @param timestamp Timestamp
 * @param seq IMU seq
 * @param roll Roll angle in rad
 * @param pitch Pitch angle in rad
 * @param yaw Yaw angle in rad
 * @param local_z Local frame Z coordinate (height over ground)
 * @param lat GPS X coordinate
 * @param lon GPS Y coordinate
 * @param alt Global frame altitude
LM's avatar
LM committed
194 195 196
 * @param ground_x Ground truth X
 * @param ground_y Ground truth Y
 * @param ground_z Ground truth Z
James Goppert's avatar
James Goppert committed
197
 */
lm's avatar
lm committed
198 199
#ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS

lm's avatar
lm committed
200 201
static inline void mavlink_msg_image_triggered_send(mavlink_channel_t chan, uint64_t timestamp, uint32_t seq, float roll, float pitch, float yaw, float local_z, float lat, float lon, float alt, float ground_x, float ground_y, float ground_z)
{
LM's avatar
LM committed
202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234
#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
	char buf[52];
	_mav_put_uint64_t(buf, 0, timestamp);
	_mav_put_uint32_t(buf, 8, seq);
	_mav_put_float(buf, 12, roll);
	_mav_put_float(buf, 16, pitch);
	_mav_put_float(buf, 20, yaw);
	_mav_put_float(buf, 24, local_z);
	_mav_put_float(buf, 28, lat);
	_mav_put_float(buf, 32, lon);
	_mav_put_float(buf, 36, alt);
	_mav_put_float(buf, 40, ground_x);
	_mav_put_float(buf, 44, ground_y);
	_mav_put_float(buf, 48, ground_z);

	_mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_IMAGE_TRIGGERED, buf, 52, 86);
#else
	mavlink_image_triggered_t packet;
	packet.timestamp = timestamp;
	packet.seq = seq;
	packet.roll = roll;
	packet.pitch = pitch;
	packet.yaw = yaw;
	packet.local_z = local_z;
	packet.lat = lat;
	packet.lon = lon;
	packet.alt = alt;
	packet.ground_x = ground_x;
	packet.ground_y = ground_y;
	packet.ground_z = ground_z;

	_mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_IMAGE_TRIGGERED, (const char *)&packet, 52, 86);
#endif
James Goppert's avatar
James Goppert committed
235 236 237
}

#endif
lm's avatar
lm committed
238

James Goppert's avatar
James Goppert committed
239 240
// MESSAGE IMAGE_TRIGGERED UNPACKING

lm's avatar
lm committed
241

James Goppert's avatar
James Goppert committed
242 243 244 245 246 247 248
/**
 * @brief Get field timestamp from image_triggered message
 *
 * @return Timestamp
 */
static inline uint64_t mavlink_msg_image_triggered_get_timestamp(const mavlink_message_t* msg)
{
LM's avatar
LM committed
249
	return _MAV_RETURN_uint64_t(msg,  0);
James Goppert's avatar
James Goppert committed
250 251 252 253 254 255 256 257 258
}

/**
 * @brief Get field seq from image_triggered message
 *
 * @return IMU seq
 */
static inline uint32_t mavlink_msg_image_triggered_get_seq(const mavlink_message_t* msg)
{
LM's avatar
LM committed
259
	return _MAV_RETURN_uint32_t(msg,  8);
James Goppert's avatar
James Goppert committed
260 261 262 263 264 265 266 267 268
}

/**
 * @brief Get field roll from image_triggered message
 *
 * @return Roll angle in rad
 */
static inline float mavlink_msg_image_triggered_get_roll(const mavlink_message_t* msg)
{
LM's avatar
LM committed
269
	return _MAV_RETURN_float(msg,  12);
James Goppert's avatar
James Goppert committed
270 271 272 273 274 275 276 277 278
}

/**
 * @brief Get field pitch from image_triggered message
 *
 * @return Pitch angle in rad
 */
static inline float mavlink_msg_image_triggered_get_pitch(const mavlink_message_t* msg)
{
LM's avatar
LM committed
279
	return _MAV_RETURN_float(msg,  16);
James Goppert's avatar
James Goppert committed
280 281 282 283 284 285 286 287 288
}

/**
 * @brief Get field yaw from image_triggered message
 *
 * @return Yaw angle in rad
 */
static inline float mavlink_msg_image_triggered_get_yaw(const mavlink_message_t* msg)
{
LM's avatar
LM committed
289
	return _MAV_RETURN_float(msg,  20);
James Goppert's avatar
James Goppert committed
290 291 292 293 294 295 296 297 298
}

/**
 * @brief Get field local_z from image_triggered message
 *
 * @return Local frame Z coordinate (height over ground)
 */
static inline float mavlink_msg_image_triggered_get_local_z(const mavlink_message_t* msg)
{
LM's avatar
LM committed
299
	return _MAV_RETURN_float(msg,  24);
James Goppert's avatar
James Goppert committed
300 301 302 303 304 305 306 307 308
}

/**
 * @brief Get field lat from image_triggered message
 *
 * @return GPS X coordinate
 */
static inline float mavlink_msg_image_triggered_get_lat(const mavlink_message_t* msg)
{
LM's avatar
LM committed
309
	return _MAV_RETURN_float(msg,  28);
James Goppert's avatar
James Goppert committed
310 311 312 313 314 315 316 317 318
}

/**
 * @brief Get field lon from image_triggered message
 *
 * @return GPS Y coordinate
 */
static inline float mavlink_msg_image_triggered_get_lon(const mavlink_message_t* msg)
{
LM's avatar
LM committed
319
	return _MAV_RETURN_float(msg,  32);
James Goppert's avatar
James Goppert committed
320 321 322 323 324 325 326 327 328
}

/**
 * @brief Get field alt from image_triggered message
 *
 * @return Global frame altitude
 */
static inline float mavlink_msg_image_triggered_get_alt(const mavlink_message_t* msg)
{
LM's avatar
LM committed
329
	return _MAV_RETURN_float(msg,  36);
James Goppert's avatar
James Goppert committed
330 331
}

LM's avatar
LM committed
332 333 334 335 336 337 338
/**
 * @brief Get field ground_x from image_triggered message
 *
 * @return Ground truth X
 */
static inline float mavlink_msg_image_triggered_get_ground_x(const mavlink_message_t* msg)
{
LM's avatar
LM committed
339
	return _MAV_RETURN_float(msg,  40);
LM's avatar
LM committed
340 341 342 343 344 345 346 347 348
}

/**
 * @brief Get field ground_y from image_triggered message
 *
 * @return Ground truth Y
 */
static inline float mavlink_msg_image_triggered_get_ground_y(const mavlink_message_t* msg)
{
LM's avatar
LM committed
349
	return _MAV_RETURN_float(msg,  44);
LM's avatar
LM committed
350 351 352 353 354 355 356 357 358
}

/**
 * @brief Get field ground_z from image_triggered message
 *
 * @return Ground truth Z
 */
static inline float mavlink_msg_image_triggered_get_ground_z(const mavlink_message_t* msg)
{
LM's avatar
LM committed
359
	return _MAV_RETURN_float(msg,  48);
LM's avatar
LM committed
360 361
}

James Goppert's avatar
James Goppert committed
362 363 364 365 366 367 368 369
/**
 * @brief Decode a image_triggered message into a struct
 *
 * @param msg The message to decode
 * @param image_triggered C-struct to decode the message contents into
 */
static inline void mavlink_msg_image_triggered_decode(const mavlink_message_t* msg, mavlink_image_triggered_t* image_triggered)
{
lm's avatar
lm committed
370 371 372 373 374 375 376 377 378 379 380 381 382 383
#if MAVLINK_NEED_BYTE_SWAP
	image_triggered->timestamp = mavlink_msg_image_triggered_get_timestamp(msg);
	image_triggered->seq = mavlink_msg_image_triggered_get_seq(msg);
	image_triggered->roll = mavlink_msg_image_triggered_get_roll(msg);
	image_triggered->pitch = mavlink_msg_image_triggered_get_pitch(msg);
	image_triggered->yaw = mavlink_msg_image_triggered_get_yaw(msg);
	image_triggered->local_z = mavlink_msg_image_triggered_get_local_z(msg);
	image_triggered->lat = mavlink_msg_image_triggered_get_lat(msg);
	image_triggered->lon = mavlink_msg_image_triggered_get_lon(msg);
	image_triggered->alt = mavlink_msg_image_triggered_get_alt(msg);
	image_triggered->ground_x = mavlink_msg_image_triggered_get_ground_x(msg);
	image_triggered->ground_y = mavlink_msg_image_triggered_get_ground_y(msg);
	image_triggered->ground_z = mavlink_msg_image_triggered_get_ground_z(msg);
#else
LM's avatar
LM committed
384
	memcpy(image_triggered, _MAV_PAYLOAD(msg), 52);
lm's avatar
lm committed
385
#endif
James Goppert's avatar
James Goppert committed
386
}