mavlink_msg_terrain_report.h
Go to the documentation of this file.
1 // MESSAGE TERRAIN_REPORT PACKING
2 
3 #define MAVLINK_MSG_ID_TERRAIN_REPORT 136
4 
6 {
7  int32_t lat; /*< Latitude (degrees *10^7)*/
8  int32_t lon; /*< Longitude (degrees *10^7)*/
9  float terrain_height; /*< Terrain height in meters AMSL*/
10  float current_height; /*< Current vehicle height above lat/lon terrain height (meters)*/
11  uint16_t spacing; /*< grid spacing (zero if terrain at this location unavailable)*/
12  uint16_t pending; /*< Number of 4x4 terrain blocks waiting to be received or read from disk*/
13  uint16_t loaded; /*< Number of 4x4 terrain blocks in memory*/
15 
16 #define MAVLINK_MSG_ID_TERRAIN_REPORT_LEN 22
17 #define MAVLINK_MSG_ID_136_LEN 22
18 
19 #define MAVLINK_MSG_ID_TERRAIN_REPORT_CRC 1
20 #define MAVLINK_MSG_ID_136_CRC 1
21 
22 
23 
24 #define MAVLINK_MESSAGE_INFO_TERRAIN_REPORT { \
25  "TERRAIN_REPORT", \
26  7, \
27  { { "lat", NULL, MAVLINK_TYPE_INT32_T, 0, 0, offsetof(mavlink_terrain_report_t, lat) }, \
28  { "lon", NULL, MAVLINK_TYPE_INT32_T, 0, 4, offsetof(mavlink_terrain_report_t, lon) }, \
29  { "terrain_height", NULL, MAVLINK_TYPE_FLOAT, 0, 8, offsetof(mavlink_terrain_report_t, terrain_height) }, \
30  { "current_height", NULL, MAVLINK_TYPE_FLOAT, 0, 12, offsetof(mavlink_terrain_report_t, current_height) }, \
31  { "spacing", NULL, MAVLINK_TYPE_UINT16_T, 0, 16, offsetof(mavlink_terrain_report_t, spacing) }, \
32  { "pending", NULL, MAVLINK_TYPE_UINT16_T, 0, 18, offsetof(mavlink_terrain_report_t, pending) }, \
33  { "loaded", NULL, MAVLINK_TYPE_UINT16_T, 0, 20, offsetof(mavlink_terrain_report_t, loaded) }, \
34  } \
35 }
36 
37 
53 static inline uint16_t mavlink_msg_terrain_report_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg,
54  int32_t lat, int32_t lon, uint16_t spacing, float terrain_height, float current_height, uint16_t pending, uint16_t loaded)
55 {
56 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
58  _mav_put_int32_t(buf, 0, lat);
59  _mav_put_int32_t(buf, 4, lon);
60  _mav_put_float(buf, 8, terrain_height);
61  _mav_put_float(buf, 12, current_height);
62  _mav_put_uint16_t(buf, 16, spacing);
63  _mav_put_uint16_t(buf, 18, pending);
64  _mav_put_uint16_t(buf, 20, loaded);
65 
67 #else
69  packet.lat = lat;
70  packet.lon = lon;
73  packet.spacing = spacing;
74  packet.pending = pending;
75  packet.loaded = loaded;
76 
78 #endif
79 
80  msg->msgid = MAVLINK_MSG_ID_TERRAIN_REPORT;
81 #if MAVLINK_CRC_EXTRA
83 #else
84  return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_TERRAIN_REPORT_LEN);
85 #endif
86 }
87 
103 static inline uint16_t mavlink_msg_terrain_report_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan,
104  mavlink_message_t* msg,
105  int32_t lat,int32_t lon,uint16_t spacing,float terrain_height,float current_height,uint16_t pending,uint16_t loaded)
106 {
107 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
109  _mav_put_int32_t(buf, 0, lat);
110  _mav_put_int32_t(buf, 4, lon);
111  _mav_put_float(buf, 8, terrain_height);
112  _mav_put_float(buf, 12, current_height);
113  _mav_put_uint16_t(buf, 16, spacing);
114  _mav_put_uint16_t(buf, 18, pending);
115  _mav_put_uint16_t(buf, 20, loaded);
116 
118 #else
120  packet.lat = lat;
121  packet.lon = lon;
124  packet.spacing = spacing;
125  packet.pending = pending;
126  packet.loaded = loaded;
127 
129 #endif
130 
131  msg->msgid = MAVLINK_MSG_ID_TERRAIN_REPORT;
132 #if MAVLINK_CRC_EXTRA
134 #else
135  return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_TERRAIN_REPORT_LEN);
136 #endif
137 }
138 
147 static inline uint16_t mavlink_msg_terrain_report_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_terrain_report_t* terrain_report)
148 {
149  return mavlink_msg_terrain_report_pack(system_id, component_id, msg, terrain_report->lat, terrain_report->lon, terrain_report->spacing, terrain_report->terrain_height, terrain_report->current_height, terrain_report->pending, terrain_report->loaded);
150 }
151 
161 static inline uint16_t mavlink_msg_terrain_report_encode_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, const mavlink_terrain_report_t* terrain_report)
162 {
163  return mavlink_msg_terrain_report_pack_chan(system_id, component_id, chan, msg, terrain_report->lat, terrain_report->lon, terrain_report->spacing, terrain_report->terrain_height, terrain_report->current_height, terrain_report->pending, terrain_report->loaded);
164 }
165 
178 #ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS
179 
180 static inline void mavlink_msg_terrain_report_send(mavlink_channel_t chan, int32_t lat, int32_t lon, uint16_t spacing, float terrain_height, float current_height, uint16_t pending, uint16_t loaded)
181 {
182 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
184  _mav_put_int32_t(buf, 0, lat);
185  _mav_put_int32_t(buf, 4, lon);
187  _mav_put_float(buf, 12, current_height);
188  _mav_put_uint16_t(buf, 16, spacing);
189  _mav_put_uint16_t(buf, 18, pending);
190  _mav_put_uint16_t(buf, 20, loaded);
191 
192 #if MAVLINK_CRC_EXTRA
194 #else
195  _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_TERRAIN_REPORT, buf, MAVLINK_MSG_ID_TERRAIN_REPORT_LEN);
196 #endif
197 #else
199  packet.lat = lat;
200  packet.lon = lon;
203  packet.spacing = spacing;
204  packet.pending = pending;
205  packet.loaded = loaded;
206 
207 #if MAVLINK_CRC_EXTRA
208  _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_TERRAIN_REPORT, (const char *)&packet, MAVLINK_MSG_ID_TERRAIN_REPORT_LEN, MAVLINK_MSG_ID_TERRAIN_REPORT_CRC);
209 #else
210  _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_TERRAIN_REPORT, (const char *)&packet, MAVLINK_MSG_ID_TERRAIN_REPORT_LEN);
211 #endif
212 #endif
213 }
214 
215 #if MAVLINK_MSG_ID_TERRAIN_REPORT_LEN <= MAVLINK_MAX_PAYLOAD_LEN
216 /*
217  This varient of _send() can be used to save stack space by re-using
218  memory from the receive buffer. The caller provides a
219  mavlink_message_t which is the size of a full mavlink message. This
220  is usually the receive buffer for the channel, and allows a reply to an
221  incoming message with minimum stack space usage.
222  */
223 static inline void mavlink_msg_terrain_report_send_buf(mavlink_message_t *msgbuf, mavlink_channel_t chan, int32_t lat, int32_t lon, uint16_t spacing, float terrain_height, float current_height, uint16_t pending, uint16_t loaded)
224 {
225 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
226  char *buf = (char *)msgbuf;
227  _mav_put_int32_t(buf, 0, lat);
228  _mav_put_int32_t(buf, 4, lon);
230  _mav_put_float(buf, 12, current_height);
231  _mav_put_uint16_t(buf, 16, spacing);
232  _mav_put_uint16_t(buf, 18, pending);
233  _mav_put_uint16_t(buf, 20, loaded);
234 
235 #if MAVLINK_CRC_EXTRA
237 #else
238  _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_TERRAIN_REPORT, buf, MAVLINK_MSG_ID_TERRAIN_REPORT_LEN);
239 #endif
240 #else
242  packet->lat = lat;
243  packet->lon = lon;
244  packet->terrain_height = terrain_height;
245  packet->current_height = current_height;
246  packet->spacing = spacing;
247  packet->pending = pending;
248  packet->loaded = loaded;
249 
250 #if MAVLINK_CRC_EXTRA
251  _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_TERRAIN_REPORT, (const char *)packet, MAVLINK_MSG_ID_TERRAIN_REPORT_LEN, MAVLINK_MSG_ID_TERRAIN_REPORT_CRC);
252 #else
253  _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_TERRAIN_REPORT, (const char *)packet, MAVLINK_MSG_ID_TERRAIN_REPORT_LEN);
254 #endif
255 #endif
256 }
257 #endif
258 
259 #endif
260 
261 // MESSAGE TERRAIN_REPORT UNPACKING
262 
263 
269 static inline int32_t mavlink_msg_terrain_report_get_lat(const mavlink_message_t* msg)
270 {
271  return _MAV_RETURN_int32_t(msg, 0);
272 }
273 
279 static inline int32_t mavlink_msg_terrain_report_get_lon(const mavlink_message_t* msg)
280 {
281  return _MAV_RETURN_int32_t(msg, 4);
282 }
283 
289 static inline uint16_t mavlink_msg_terrain_report_get_spacing(const mavlink_message_t* msg)
290 {
291  return _MAV_RETURN_uint16_t(msg, 16);
292 }
293 
299 static inline float mavlink_msg_terrain_report_get_terrain_height(const mavlink_message_t* msg)
300 {
301  return _MAV_RETURN_float(msg, 8);
302 }
303 
309 static inline float mavlink_msg_terrain_report_get_current_height(const mavlink_message_t* msg)
310 {
311  return _MAV_RETURN_float(msg, 12);
312 }
313 
319 static inline uint16_t mavlink_msg_terrain_report_get_pending(const mavlink_message_t* msg)
320 {
321  return _MAV_RETURN_uint16_t(msg, 18);
322 }
323 
329 static inline uint16_t mavlink_msg_terrain_report_get_loaded(const mavlink_message_t* msg)
330 {
331  return _MAV_RETURN_uint16_t(msg, 20);
332 }
333 
340 static inline void mavlink_msg_terrain_report_decode(const mavlink_message_t* msg, mavlink_terrain_report_t* terrain_report)
341 {
342 #if MAVLINK_NEED_BYTE_SWAP
343  terrain_report->lat = mavlink_msg_terrain_report_get_lat(msg);
344  terrain_report->lon = mavlink_msg_terrain_report_get_lon(msg);
347  terrain_report->spacing = mavlink_msg_terrain_report_get_spacing(msg);
348  terrain_report->pending = mavlink_msg_terrain_report_get_pending(msg);
349  terrain_report->loaded = mavlink_msg_terrain_report_get_loaded(msg);
350 #else
351  memcpy(terrain_report, _MAV_PAYLOAD(msg), MAVLINK_MSG_ID_TERRAIN_REPORT_LEN);
352 #endif
353 }
#define _mav_put_float(buf, wire_offset, b)
Definition: protocol.h:151
#define _mav_put_int32_t(buf, wire_offset, b)
Definition: protocol.h:148
#define _mav_put_uint16_t(buf, wire_offset, b)
Definition: protocol.h:145


rosflight
Author(s): Daniel Koch , James Jackson
autogenerated on Wed Jul 3 2019 20:00:13