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

#define MAVLINK_MSG_ID_IMAGE_TRIGGERED 101
lm's avatar
lm committed
4 5
#define MAVLINK_MSG_ID_IMAGE_TRIGGERED_LEN 52
#define MAVLINK_MSG_101_LEN 52
lm's avatar
lm committed
6 7
#define MAVLINK_MSG_ID_IMAGE_TRIGGERED_KEY 0x8
#define MAVLINK_MSG_101_KEY 0x8
James Goppert's avatar
James Goppert committed
8 9 10

typedef struct __mavlink_image_triggered_t 
{
lm's avatar
lm committed
11 12 13 14 15 16 17 18 19 20 21 22
	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
23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40

} mavlink_image_triggered_t;

/**
 * @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
41 42 43
 * @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
44 45
 * @return length of the message in bytes (excluding serial stream start sign)
 */
LM's avatar
LM committed
46
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
47
{
lm's avatar
lm committed
48
	mavlink_image_triggered_t *p = (mavlink_image_triggered_t *)&msg->payload[0];
James Goppert's avatar
James Goppert committed
49 50
	msg->msgid = MAVLINK_MSG_ID_IMAGE_TRIGGERED;

lm's avatar
lm committed
51 52 53 54 55 56 57 58 59 60 61 62
	p->timestamp = timestamp;	// uint64_t:Timestamp
	p->seq = seq;	// uint32_t:IMU seq
	p->roll = roll;	// float:Roll angle in rad
	p->pitch = pitch;	// float:Pitch angle in rad
	p->yaw = yaw;	// float:Yaw angle in rad
	p->local_z = local_z;	// float:Local frame Z coordinate (height over ground)
	p->lat = lat;	// float:GPS X coordinate
	p->lon = lon;	// float:GPS Y coordinate
	p->alt = alt;	// float:Global frame altitude
	p->ground_x = ground_x;	// float:Ground truth X
	p->ground_y = ground_y;	// float:Ground truth Y
	p->ground_z = ground_z;	// float:Ground truth Z
lm's avatar
lm committed
63 64

	return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_IMAGE_TRIGGERED_LEN);
James Goppert's avatar
James Goppert committed
65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81
}

/**
 * @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 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
82 83 84
 * @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
85 86
 * @return length of the message in bytes (excluding serial stream start sign)
 */
LM's avatar
LM committed
87
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)
James Goppert's avatar
James Goppert committed
88
{
lm's avatar
lm committed
89
	mavlink_image_triggered_t *p = (mavlink_image_triggered_t *)&msg->payload[0];
James Goppert's avatar
James Goppert committed
90 91
	msg->msgid = MAVLINK_MSG_ID_IMAGE_TRIGGERED;

lm's avatar
lm committed
92 93 94 95 96 97 98 99 100 101 102 103
	p->timestamp = timestamp;	// uint64_t:Timestamp
	p->seq = seq;	// uint32_t:IMU seq
	p->roll = roll;	// float:Roll angle in rad
	p->pitch = pitch;	// float:Pitch angle in rad
	p->yaw = yaw;	// float:Yaw angle in rad
	p->local_z = local_z;	// float:Local frame Z coordinate (height over ground)
	p->lat = lat;	// float:GPS X coordinate
	p->lon = lon;	// float:GPS Y coordinate
	p->alt = alt;	// float:Global frame altitude
	p->ground_x = ground_x;	// float:Ground truth X
	p->ground_y = ground_y;	// float:Ground truth Y
	p->ground_z = ground_z;	// float:Ground truth Z
lm's avatar
lm committed
104 105

	return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_IMAGE_TRIGGERED_LEN);
James Goppert's avatar
James Goppert committed
106 107 108 109 110 111 112 113 114 115 116 117
}

/**
 * @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
118
	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
119 120
}

lm's avatar
lm committed
121 122

#ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS
James Goppert's avatar
James Goppert committed
123 124 125 126 127 128 129 130 131 132 133 134 135
/**
 * @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
136 137 138
 * @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
139
 */
lm's avatar
lm committed
140 141 142 143
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)
{
	mavlink_header_t hdr;
	mavlink_image_triggered_t payload;
lm's avatar
lm committed
144 145 146 147 148 149 150 151 152 153 154 155 156 157

	MAVLINK_BUFFER_CHECK_START( chan, MAVLINK_MSG_ID_IMAGE_TRIGGERED_LEN )
	payload.timestamp = timestamp;	// uint64_t:Timestamp
	payload.seq = seq;	// uint32_t:IMU seq
	payload.roll = roll;	// float:Roll angle in rad
	payload.pitch = pitch;	// float:Pitch angle in rad
	payload.yaw = yaw;	// float:Yaw angle in rad
	payload.local_z = local_z;	// float:Local frame Z coordinate (height over ground)
	payload.lat = lat;	// float:GPS X coordinate
	payload.lon = lon;	// float:GPS Y coordinate
	payload.alt = alt;	// float:Global frame altitude
	payload.ground_x = ground_x;	// float:Ground truth X
	payload.ground_y = ground_y;	// float:Ground truth Y
	payload.ground_z = ground_z;	// float:Ground truth Z
lm's avatar
lm committed
158 159 160 161 162 163 164 165 166

	hdr.STX = MAVLINK_STX;
	hdr.len = MAVLINK_MSG_ID_IMAGE_TRIGGERED_LEN;
	hdr.msgid = MAVLINK_MSG_ID_IMAGE_TRIGGERED;
	hdr.sysid = mavlink_system.sysid;
	hdr.compid = mavlink_system.compid;
	hdr.seq = mavlink_get_channel_status(chan)->current_tx_seq;
	mavlink_get_channel_status(chan)->current_tx_seq = hdr.seq + 1;
	mavlink_send_mem(chan, (uint8_t *)&hdr.STX, MAVLINK_NUM_HEADER_BYTES );
167
	mavlink_send_mem(chan, (uint8_t *)&payload, sizeof(payload) );
lm's avatar
lm committed
168

lm's avatar
lm committed
169 170 171 172 173 174
	crc_init(&hdr.ck);
	crc_calculate_mem((uint8_t *)&hdr.len, &hdr.ck, MAVLINK_CORE_HEADER_LEN);
	crc_calculate_mem((uint8_t *)&payload, &hdr.ck, hdr.len );
	crc_accumulate( 0x8, &hdr.ck); /// include key in X25 checksum
	mavlink_send_mem(chan, (uint8_t *)&hdr.ck, MAVLINK_NUM_CHECKSUM_BYTES);
	MAVLINK_BUFFER_CHECK_END
James Goppert's avatar
James Goppert committed
175 176 177 178 179 180 181 182 183 184 185 186
}

#endif
// MESSAGE IMAGE_TRIGGERED UNPACKING

/**
 * @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
187 188
	mavlink_image_triggered_t *p = (mavlink_image_triggered_t *)&msg->payload[0];
	return (uint64_t)(p->timestamp);
James Goppert's avatar
James Goppert committed
189 190 191 192 193 194 195 196 197
}

/**
 * @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
198 199
	mavlink_image_triggered_t *p = (mavlink_image_triggered_t *)&msg->payload[0];
	return (uint32_t)(p->seq);
James Goppert's avatar
James Goppert committed
200 201 202 203 204 205 206 207 208
}

/**
 * @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
209 210
	mavlink_image_triggered_t *p = (mavlink_image_triggered_t *)&msg->payload[0];
	return (float)(p->roll);
James Goppert's avatar
James Goppert committed
211 212 213 214 215 216 217 218 219
}

/**
 * @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
220 221
	mavlink_image_triggered_t *p = (mavlink_image_triggered_t *)&msg->payload[0];
	return (float)(p->pitch);
James Goppert's avatar
James Goppert committed
222 223 224 225 226 227 228 229 230
}

/**
 * @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
231 232
	mavlink_image_triggered_t *p = (mavlink_image_triggered_t *)&msg->payload[0];
	return (float)(p->yaw);
James Goppert's avatar
James Goppert committed
233 234 235 236 237 238 239 240 241
}

/**
 * @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
242 243
	mavlink_image_triggered_t *p = (mavlink_image_triggered_t *)&msg->payload[0];
	return (float)(p->local_z);
James Goppert's avatar
James Goppert committed
244 245 246 247 248 249 250 251 252
}

/**
 * @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
253 254
	mavlink_image_triggered_t *p = (mavlink_image_triggered_t *)&msg->payload[0];
	return (float)(p->lat);
James Goppert's avatar
James Goppert committed
255 256 257 258 259 260 261 262 263
}

/**
 * @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
264 265
	mavlink_image_triggered_t *p = (mavlink_image_triggered_t *)&msg->payload[0];
	return (float)(p->lon);
James Goppert's avatar
James Goppert committed
266 267 268 269 270 271 272 273 274
}

/**
 * @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
275 276
	mavlink_image_triggered_t *p = (mavlink_image_triggered_t *)&msg->payload[0];
	return (float)(p->alt);
James Goppert's avatar
James Goppert committed
277 278
}

LM's avatar
LM committed
279 280 281 282 283 284 285
/**
 * @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
286 287
	mavlink_image_triggered_t *p = (mavlink_image_triggered_t *)&msg->payload[0];
	return (float)(p->ground_x);
LM's avatar
LM committed
288 289 290 291 292 293 294 295 296
}

/**
 * @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
297 298
	mavlink_image_triggered_t *p = (mavlink_image_triggered_t *)&msg->payload[0];
	return (float)(p->ground_y);
LM's avatar
LM committed
299 300 301 302 303 304 305 306 307
}

/**
 * @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
308 309
	mavlink_image_triggered_t *p = (mavlink_image_triggered_t *)&msg->payload[0];
	return (float)(p->ground_z);
LM's avatar
LM committed
310 311
}

James Goppert's avatar
James Goppert committed
312 313 314 315 316 317 318 319
/**
 * @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
320
	memcpy( image_triggered, msg->payload, sizeof(mavlink_image_triggered_t));
James Goppert's avatar
James Goppert committed
321
}