[88] | 1 | // MESSAGE SET_HOME_POSITION PACKING
|
---|
| 2 |
|
---|
| 3 | #define MAVLINK_MSG_ID_SET_HOME_POSITION 243
|
---|
| 4 |
|
---|
| 5 | typedef struct MAVLINK_PACKED __mavlink_set_home_position_t
|
---|
| 6 | {
|
---|
| 7 | int32_t latitude; /*< Latitude (WGS84), in degrees * 1E7*/
|
---|
| 8 | int32_t longitude; /*< Longitude (WGS84, in degrees * 1E7*/
|
---|
| 9 | int32_t altitude; /*< Altitude (AMSL), in meters * 1000 (positive for up)*/
|
---|
| 10 | float x; /*< Local X position of this position in the local coordinate frame*/
|
---|
| 11 | float y; /*< Local Y position of this position in the local coordinate frame*/
|
---|
| 12 | float z; /*< Local Z position of this position in the local coordinate frame*/
|
---|
| 13 | float q[4]; /*< World to surface normal and heading transformation of the takeoff position. Used to indicate the heading and slope of the ground*/
|
---|
| 14 | float approach_x; /*< Local X position of the end of the approach vector. Multicopters should set this position based on their takeoff path. Grass-landing fixed wing aircraft should set it the same way as multicopters. Runway-landing fixed wing aircraft should set it to the opposite direction of the takeoff, assuming the takeoff happened from the threshold / touchdown zone.*/
|
---|
| 15 | float approach_y; /*< Local Y position of the end of the approach vector. Multicopters should set this position based on their takeoff path. Grass-landing fixed wing aircraft should set it the same way as multicopters. Runway-landing fixed wing aircraft should set it to the opposite direction of the takeoff, assuming the takeoff happened from the threshold / touchdown zone.*/
|
---|
| 16 | float approach_z; /*< Local Z position of the end of the approach vector. Multicopters should set this position based on their takeoff path. Grass-landing fixed wing aircraft should set it the same way as multicopters. Runway-landing fixed wing aircraft should set it to the opposite direction of the takeoff, assuming the takeoff happened from the threshold / touchdown zone.*/
|
---|
| 17 | uint8_t target_system; /*< System ID.*/
|
---|
| 18 | } mavlink_set_home_position_t;
|
---|
| 19 |
|
---|
| 20 | #define MAVLINK_MSG_ID_SET_HOME_POSITION_LEN 53
|
---|
| 21 | #define MAVLINK_MSG_ID_SET_HOME_POSITION_MIN_LEN 53
|
---|
| 22 | #define MAVLINK_MSG_ID_243_LEN 53
|
---|
| 23 | #define MAVLINK_MSG_ID_243_MIN_LEN 53
|
---|
| 24 |
|
---|
| 25 | #define MAVLINK_MSG_ID_SET_HOME_POSITION_CRC 85
|
---|
| 26 | #define MAVLINK_MSG_ID_243_CRC 85
|
---|
| 27 |
|
---|
| 28 | #define MAVLINK_MSG_SET_HOME_POSITION_FIELD_Q_LEN 4
|
---|
| 29 |
|
---|
| 30 | #if MAVLINK_COMMAND_24BIT
|
---|
| 31 | #define MAVLINK_MESSAGE_INFO_SET_HOME_POSITION { \
|
---|
| 32 | 243, \
|
---|
| 33 | "SET_HOME_POSITION", \
|
---|
| 34 | 11, \
|
---|
| 35 | { { "latitude", NULL, MAVLINK_TYPE_INT32_T, 0, 0, offsetof(mavlink_set_home_position_t, latitude) }, \
|
---|
| 36 | { "longitude", NULL, MAVLINK_TYPE_INT32_T, 0, 4, offsetof(mavlink_set_home_position_t, longitude) }, \
|
---|
| 37 | { "altitude", NULL, MAVLINK_TYPE_INT32_T, 0, 8, offsetof(mavlink_set_home_position_t, altitude) }, \
|
---|
| 38 | { "x", NULL, MAVLINK_TYPE_FLOAT, 0, 12, offsetof(mavlink_set_home_position_t, x) }, \
|
---|
| 39 | { "y", NULL, MAVLINK_TYPE_FLOAT, 0, 16, offsetof(mavlink_set_home_position_t, y) }, \
|
---|
| 40 | { "z", NULL, MAVLINK_TYPE_FLOAT, 0, 20, offsetof(mavlink_set_home_position_t, z) }, \
|
---|
| 41 | { "q", NULL, MAVLINK_TYPE_FLOAT, 4, 24, offsetof(mavlink_set_home_position_t, q) }, \
|
---|
| 42 | { "approach_x", NULL, MAVLINK_TYPE_FLOAT, 0, 40, offsetof(mavlink_set_home_position_t, approach_x) }, \
|
---|
| 43 | { "approach_y", NULL, MAVLINK_TYPE_FLOAT, 0, 44, offsetof(mavlink_set_home_position_t, approach_y) }, \
|
---|
| 44 | { "approach_z", NULL, MAVLINK_TYPE_FLOAT, 0, 48, offsetof(mavlink_set_home_position_t, approach_z) }, \
|
---|
| 45 | { "target_system", NULL, MAVLINK_TYPE_UINT8_T, 0, 52, offsetof(mavlink_set_home_position_t, target_system) }, \
|
---|
| 46 | } \
|
---|
| 47 | }
|
---|
| 48 | #else
|
---|
| 49 | #define MAVLINK_MESSAGE_INFO_SET_HOME_POSITION { \
|
---|
| 50 | "SET_HOME_POSITION", \
|
---|
| 51 | 11, \
|
---|
| 52 | { { "latitude", NULL, MAVLINK_TYPE_INT32_T, 0, 0, offsetof(mavlink_set_home_position_t, latitude) }, \
|
---|
| 53 | { "longitude", NULL, MAVLINK_TYPE_INT32_T, 0, 4, offsetof(mavlink_set_home_position_t, longitude) }, \
|
---|
| 54 | { "altitude", NULL, MAVLINK_TYPE_INT32_T, 0, 8, offsetof(mavlink_set_home_position_t, altitude) }, \
|
---|
| 55 | { "x", NULL, MAVLINK_TYPE_FLOAT, 0, 12, offsetof(mavlink_set_home_position_t, x) }, \
|
---|
| 56 | { "y", NULL, MAVLINK_TYPE_FLOAT, 0, 16, offsetof(mavlink_set_home_position_t, y) }, \
|
---|
| 57 | { "z", NULL, MAVLINK_TYPE_FLOAT, 0, 20, offsetof(mavlink_set_home_position_t, z) }, \
|
---|
| 58 | { "q", NULL, MAVLINK_TYPE_FLOAT, 4, 24, offsetof(mavlink_set_home_position_t, q) }, \
|
---|
| 59 | { "approach_x", NULL, MAVLINK_TYPE_FLOAT, 0, 40, offsetof(mavlink_set_home_position_t, approach_x) }, \
|
---|
| 60 | { "approach_y", NULL, MAVLINK_TYPE_FLOAT, 0, 44, offsetof(mavlink_set_home_position_t, approach_y) }, \
|
---|
| 61 | { "approach_z", NULL, MAVLINK_TYPE_FLOAT, 0, 48, offsetof(mavlink_set_home_position_t, approach_z) }, \
|
---|
| 62 | { "target_system", NULL, MAVLINK_TYPE_UINT8_T, 0, 52, offsetof(mavlink_set_home_position_t, target_system) }, \
|
---|
| 63 | } \
|
---|
| 64 | }
|
---|
| 65 | #endif
|
---|
| 66 |
|
---|
| 67 | /**
|
---|
| 68 | * @brief Pack a set_home_position message
|
---|
| 69 | * @param system_id ID of this system
|
---|
| 70 | * @param component_id ID of this component (e.g. 200 for IMU)
|
---|
| 71 | * @param msg The MAVLink message to compress the data into
|
---|
| 72 | *
|
---|
| 73 | * @param target_system System ID.
|
---|
| 74 | * @param latitude Latitude (WGS84), in degrees * 1E7
|
---|
| 75 | * @param longitude Longitude (WGS84, in degrees * 1E7
|
---|
| 76 | * @param altitude Altitude (AMSL), in meters * 1000 (positive for up)
|
---|
| 77 | * @param x Local X position of this position in the local coordinate frame
|
---|
| 78 | * @param y Local Y position of this position in the local coordinate frame
|
---|
| 79 | * @param z Local Z position of this position in the local coordinate frame
|
---|
| 80 | * @param q World to surface normal and heading transformation of the takeoff position. Used to indicate the heading and slope of the ground
|
---|
| 81 | * @param approach_x Local X position of the end of the approach vector. Multicopters should set this position based on their takeoff path. Grass-landing fixed wing aircraft should set it the same way as multicopters. Runway-landing fixed wing aircraft should set it to the opposite direction of the takeoff, assuming the takeoff happened from the threshold / touchdown zone.
|
---|
| 82 | * @param approach_y Local Y position of the end of the approach vector. Multicopters should set this position based on their takeoff path. Grass-landing fixed wing aircraft should set it the same way as multicopters. Runway-landing fixed wing aircraft should set it to the opposite direction of the takeoff, assuming the takeoff happened from the threshold / touchdown zone.
|
---|
| 83 | * @param approach_z Local Z position of the end of the approach vector. Multicopters should set this position based on their takeoff path. Grass-landing fixed wing aircraft should set it the same way as multicopters. Runway-landing fixed wing aircraft should set it to the opposite direction of the takeoff, assuming the takeoff happened from the threshold / touchdown zone.
|
---|
| 84 | * @return length of the message in bytes (excluding serial stream start sign)
|
---|
| 85 | */
|
---|
| 86 | static inline uint16_t mavlink_msg_set_home_position_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg,
|
---|
| 87 | uint8_t target_system, int32_t latitude, int32_t longitude, int32_t altitude, float x, float y, float z, const float *q, float approach_x, float approach_y, float approach_z)
|
---|
| 88 | {
|
---|
| 89 | #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
|
---|
| 90 | char buf[MAVLINK_MSG_ID_SET_HOME_POSITION_LEN];
|
---|
| 91 | _mav_put_int32_t(buf, 0, latitude);
|
---|
| 92 | _mav_put_int32_t(buf, 4, longitude);
|
---|
| 93 | _mav_put_int32_t(buf, 8, altitude);
|
---|
| 94 | _mav_put_float(buf, 12, x);
|
---|
| 95 | _mav_put_float(buf, 16, y);
|
---|
| 96 | _mav_put_float(buf, 20, z);
|
---|
| 97 | _mav_put_float(buf, 40, approach_x);
|
---|
| 98 | _mav_put_float(buf, 44, approach_y);
|
---|
| 99 | _mav_put_float(buf, 48, approach_z);
|
---|
| 100 | _mav_put_uint8_t(buf, 52, target_system);
|
---|
| 101 | _mav_put_float_array(buf, 24, q, 4);
|
---|
| 102 | memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_SET_HOME_POSITION_LEN);
|
---|
| 103 | #else
|
---|
| 104 | mavlink_set_home_position_t packet;
|
---|
| 105 | packet.latitude = latitude;
|
---|
| 106 | packet.longitude = longitude;
|
---|
| 107 | packet.altitude = altitude;
|
---|
| 108 | packet.x = x;
|
---|
| 109 | packet.y = y;
|
---|
| 110 | packet.z = z;
|
---|
| 111 | packet.approach_x = approach_x;
|
---|
| 112 | packet.approach_y = approach_y;
|
---|
| 113 | packet.approach_z = approach_z;
|
---|
| 114 | packet.target_system = target_system;
|
---|
| 115 | mav_array_memcpy(packet.q, q, sizeof(float)*4);
|
---|
| 116 | memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_SET_HOME_POSITION_LEN);
|
---|
| 117 | #endif
|
---|
| 118 |
|
---|
| 119 | msg->msgid = MAVLINK_MSG_ID_SET_HOME_POSITION;
|
---|
| 120 | return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_SET_HOME_POSITION_MIN_LEN, MAVLINK_MSG_ID_SET_HOME_POSITION_LEN, MAVLINK_MSG_ID_SET_HOME_POSITION_CRC);
|
---|
| 121 | }
|
---|
| 122 |
|
---|
| 123 | /**
|
---|
| 124 | * @brief Pack a set_home_position message on a channel
|
---|
| 125 | * @param system_id ID of this system
|
---|
| 126 | * @param component_id ID of this component (e.g. 200 for IMU)
|
---|
| 127 | * @param chan The MAVLink channel this message will be sent over
|
---|
| 128 | * @param msg The MAVLink message to compress the data into
|
---|
| 129 | * @param target_system System ID.
|
---|
| 130 | * @param latitude Latitude (WGS84), in degrees * 1E7
|
---|
| 131 | * @param longitude Longitude (WGS84, in degrees * 1E7
|
---|
| 132 | * @param altitude Altitude (AMSL), in meters * 1000 (positive for up)
|
---|
| 133 | * @param x Local X position of this position in the local coordinate frame
|
---|
| 134 | * @param y Local Y position of this position in the local coordinate frame
|
---|
| 135 | * @param z Local Z position of this position in the local coordinate frame
|
---|
| 136 | * @param q World to surface normal and heading transformation of the takeoff position. Used to indicate the heading and slope of the ground
|
---|
| 137 | * @param approach_x Local X position of the end of the approach vector. Multicopters should set this position based on their takeoff path. Grass-landing fixed wing aircraft should set it the same way as multicopters. Runway-landing fixed wing aircraft should set it to the opposite direction of the takeoff, assuming the takeoff happened from the threshold / touchdown zone.
|
---|
| 138 | * @param approach_y Local Y position of the end of the approach vector. Multicopters should set this position based on their takeoff path. Grass-landing fixed wing aircraft should set it the same way as multicopters. Runway-landing fixed wing aircraft should set it to the opposite direction of the takeoff, assuming the takeoff happened from the threshold / touchdown zone.
|
---|
| 139 | * @param approach_z Local Z position of the end of the approach vector. Multicopters should set this position based on their takeoff path. Grass-landing fixed wing aircraft should set it the same way as multicopters. Runway-landing fixed wing aircraft should set it to the opposite direction of the takeoff, assuming the takeoff happened from the threshold / touchdown zone.
|
---|
| 140 | * @return length of the message in bytes (excluding serial stream start sign)
|
---|
| 141 | */
|
---|
| 142 | static inline uint16_t mavlink_msg_set_home_position_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan,
|
---|
| 143 | mavlink_message_t* msg,
|
---|
| 144 | uint8_t target_system,int32_t latitude,int32_t longitude,int32_t altitude,float x,float y,float z,const float *q,float approach_x,float approach_y,float approach_z)
|
---|
| 145 | {
|
---|
| 146 | #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
|
---|
| 147 | char buf[MAVLINK_MSG_ID_SET_HOME_POSITION_LEN];
|
---|
| 148 | _mav_put_int32_t(buf, 0, latitude);
|
---|
| 149 | _mav_put_int32_t(buf, 4, longitude);
|
---|
| 150 | _mav_put_int32_t(buf, 8, altitude);
|
---|
| 151 | _mav_put_float(buf, 12, x);
|
---|
| 152 | _mav_put_float(buf, 16, y);
|
---|
| 153 | _mav_put_float(buf, 20, z);
|
---|
| 154 | _mav_put_float(buf, 40, approach_x);
|
---|
| 155 | _mav_put_float(buf, 44, approach_y);
|
---|
| 156 | _mav_put_float(buf, 48, approach_z);
|
---|
| 157 | _mav_put_uint8_t(buf, 52, target_system);
|
---|
| 158 | _mav_put_float_array(buf, 24, q, 4);
|
---|
| 159 | memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_SET_HOME_POSITION_LEN);
|
---|
| 160 | #else
|
---|
| 161 | mavlink_set_home_position_t packet;
|
---|
| 162 | packet.latitude = latitude;
|
---|
| 163 | packet.longitude = longitude;
|
---|
| 164 | packet.altitude = altitude;
|
---|
| 165 | packet.x = x;
|
---|
| 166 | packet.y = y;
|
---|
| 167 | packet.z = z;
|
---|
| 168 | packet.approach_x = approach_x;
|
---|
| 169 | packet.approach_y = approach_y;
|
---|
| 170 | packet.approach_z = approach_z;
|
---|
| 171 | packet.target_system = target_system;
|
---|
| 172 | mav_array_memcpy(packet.q, q, sizeof(float)*4);
|
---|
| 173 | memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_SET_HOME_POSITION_LEN);
|
---|
| 174 | #endif
|
---|
| 175 |
|
---|
| 176 | msg->msgid = MAVLINK_MSG_ID_SET_HOME_POSITION;
|
---|
| 177 | return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_SET_HOME_POSITION_MIN_LEN, MAVLINK_MSG_ID_SET_HOME_POSITION_LEN, MAVLINK_MSG_ID_SET_HOME_POSITION_CRC);
|
---|
| 178 | }
|
---|
| 179 |
|
---|
| 180 | /**
|
---|
| 181 | * @brief Encode a set_home_position struct
|
---|
| 182 | *
|
---|
| 183 | * @param system_id ID of this system
|
---|
| 184 | * @param component_id ID of this component (e.g. 200 for IMU)
|
---|
| 185 | * @param msg The MAVLink message to compress the data into
|
---|
| 186 | * @param set_home_position C-struct to read the message contents from
|
---|
| 187 | */
|
---|
| 188 | static inline uint16_t mavlink_msg_set_home_position_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_set_home_position_t* set_home_position)
|
---|
| 189 | {
|
---|
| 190 | return mavlink_msg_set_home_position_pack(system_id, component_id, msg, set_home_position->target_system, set_home_position->latitude, set_home_position->longitude, set_home_position->altitude, set_home_position->x, set_home_position->y, set_home_position->z, set_home_position->q, set_home_position->approach_x, set_home_position->approach_y, set_home_position->approach_z);
|
---|
| 191 | }
|
---|
| 192 |
|
---|
| 193 | /**
|
---|
| 194 | * @brief Encode a set_home_position struct on a channel
|
---|
| 195 | *
|
---|
| 196 | * @param system_id ID of this system
|
---|
| 197 | * @param component_id ID of this component (e.g. 200 for IMU)
|
---|
| 198 | * @param chan The MAVLink channel this message will be sent over
|
---|
| 199 | * @param msg The MAVLink message to compress the data into
|
---|
| 200 | * @param set_home_position C-struct to read the message contents from
|
---|
| 201 | */
|
---|
| 202 | static inline uint16_t mavlink_msg_set_home_position_encode_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, const mavlink_set_home_position_t* set_home_position)
|
---|
| 203 | {
|
---|
| 204 | return mavlink_msg_set_home_position_pack_chan(system_id, component_id, chan, msg, set_home_position->target_system, set_home_position->latitude, set_home_position->longitude, set_home_position->altitude, set_home_position->x, set_home_position->y, set_home_position->z, set_home_position->q, set_home_position->approach_x, set_home_position->approach_y, set_home_position->approach_z);
|
---|
| 205 | }
|
---|
| 206 |
|
---|
| 207 | /**
|
---|
| 208 | * @brief Send a set_home_position message
|
---|
| 209 | * @param chan MAVLink channel to send the message
|
---|
| 210 | *
|
---|
| 211 | * @param target_system System ID.
|
---|
| 212 | * @param latitude Latitude (WGS84), in degrees * 1E7
|
---|
| 213 | * @param longitude Longitude (WGS84, in degrees * 1E7
|
---|
| 214 | * @param altitude Altitude (AMSL), in meters * 1000 (positive for up)
|
---|
| 215 | * @param x Local X position of this position in the local coordinate frame
|
---|
| 216 | * @param y Local Y position of this position in the local coordinate frame
|
---|
| 217 | * @param z Local Z position of this position in the local coordinate frame
|
---|
| 218 | * @param q World to surface normal and heading transformation of the takeoff position. Used to indicate the heading and slope of the ground
|
---|
| 219 | * @param approach_x Local X position of the end of the approach vector. Multicopters should set this position based on their takeoff path. Grass-landing fixed wing aircraft should set it the same way as multicopters. Runway-landing fixed wing aircraft should set it to the opposite direction of the takeoff, assuming the takeoff happened from the threshold / touchdown zone.
|
---|
| 220 | * @param approach_y Local Y position of the end of the approach vector. Multicopters should set this position based on their takeoff path. Grass-landing fixed wing aircraft should set it the same way as multicopters. Runway-landing fixed wing aircraft should set it to the opposite direction of the takeoff, assuming the takeoff happened from the threshold / touchdown zone.
|
---|
| 221 | * @param approach_z Local Z position of the end of the approach vector. Multicopters should set this position based on their takeoff path. Grass-landing fixed wing aircraft should set it the same way as multicopters. Runway-landing fixed wing aircraft should set it to the opposite direction of the takeoff, assuming the takeoff happened from the threshold / touchdown zone.
|
---|
| 222 | */
|
---|
| 223 | #ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS
|
---|
| 224 |
|
---|
| 225 | static inline void mavlink_msg_set_home_position_send(mavlink_channel_t chan, uint8_t target_system, int32_t latitude, int32_t longitude, int32_t altitude, float x, float y, float z, const float *q, float approach_x, float approach_y, float approach_z)
|
---|
| 226 | {
|
---|
| 227 | #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
|
---|
| 228 | char buf[MAVLINK_MSG_ID_SET_HOME_POSITION_LEN];
|
---|
| 229 | _mav_put_int32_t(buf, 0, latitude);
|
---|
| 230 | _mav_put_int32_t(buf, 4, longitude);
|
---|
| 231 | _mav_put_int32_t(buf, 8, altitude);
|
---|
| 232 | _mav_put_float(buf, 12, x);
|
---|
| 233 | _mav_put_float(buf, 16, y);
|
---|
| 234 | _mav_put_float(buf, 20, z);
|
---|
| 235 | _mav_put_float(buf, 40, approach_x);
|
---|
| 236 | _mav_put_float(buf, 44, approach_y);
|
---|
| 237 | _mav_put_float(buf, 48, approach_z);
|
---|
| 238 | _mav_put_uint8_t(buf, 52, target_system);
|
---|
| 239 | _mav_put_float_array(buf, 24, q, 4);
|
---|
| 240 | _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_SET_HOME_POSITION, buf, MAVLINK_MSG_ID_SET_HOME_POSITION_MIN_LEN, MAVLINK_MSG_ID_SET_HOME_POSITION_LEN, MAVLINK_MSG_ID_SET_HOME_POSITION_CRC);
|
---|
| 241 | #else
|
---|
| 242 | mavlink_set_home_position_t packet;
|
---|
| 243 | packet.latitude = latitude;
|
---|
| 244 | packet.longitude = longitude;
|
---|
| 245 | packet.altitude = altitude;
|
---|
| 246 | packet.x = x;
|
---|
| 247 | packet.y = y;
|
---|
| 248 | packet.z = z;
|
---|
| 249 | packet.approach_x = approach_x;
|
---|
| 250 | packet.approach_y = approach_y;
|
---|
| 251 | packet.approach_z = approach_z;
|
---|
| 252 | packet.target_system = target_system;
|
---|
| 253 | mav_array_memcpy(packet.q, q, sizeof(float)*4);
|
---|
| 254 | _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_SET_HOME_POSITION, (const char *)&packet, MAVLINK_MSG_ID_SET_HOME_POSITION_MIN_LEN, MAVLINK_MSG_ID_SET_HOME_POSITION_LEN, MAVLINK_MSG_ID_SET_HOME_POSITION_CRC);
|
---|
| 255 | #endif
|
---|
| 256 | }
|
---|
| 257 |
|
---|
| 258 | /**
|
---|
| 259 | * @brief Send a set_home_position message
|
---|
| 260 | * @param chan MAVLink channel to send the message
|
---|
| 261 | * @param struct The MAVLink struct to serialize
|
---|
| 262 | */
|
---|
| 263 | static inline void mavlink_msg_set_home_position_send_struct(mavlink_channel_t chan, const mavlink_set_home_position_t* set_home_position)
|
---|
| 264 | {
|
---|
| 265 | #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
|
---|
| 266 | mavlink_msg_set_home_position_send(chan, set_home_position->target_system, set_home_position->latitude, set_home_position->longitude, set_home_position->altitude, set_home_position->x, set_home_position->y, set_home_position->z, set_home_position->q, set_home_position->approach_x, set_home_position->approach_y, set_home_position->approach_z);
|
---|
| 267 | #else
|
---|
| 268 | _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_SET_HOME_POSITION, (const char *)set_home_position, MAVLINK_MSG_ID_SET_HOME_POSITION_MIN_LEN, MAVLINK_MSG_ID_SET_HOME_POSITION_LEN, MAVLINK_MSG_ID_SET_HOME_POSITION_CRC);
|
---|
| 269 | #endif
|
---|
| 270 | }
|
---|
| 271 |
|
---|
| 272 | #if MAVLINK_MSG_ID_SET_HOME_POSITION_LEN <= MAVLINK_MAX_PAYLOAD_LEN
|
---|
| 273 | /*
|
---|
| 274 | This varient of _send() can be used to save stack space by re-using
|
---|
| 275 | memory from the receive buffer. The caller provides a
|
---|
| 276 | mavlink_message_t which is the size of a full mavlink message. This
|
---|
| 277 | is usually the receive buffer for the channel, and allows a reply to an
|
---|
| 278 | incoming message with minimum stack space usage.
|
---|
| 279 | */
|
---|
| 280 | static inline void mavlink_msg_set_home_position_send_buf(mavlink_message_t *msgbuf, mavlink_channel_t chan, uint8_t target_system, int32_t latitude, int32_t longitude, int32_t altitude, float x, float y, float z, const float *q, float approach_x, float approach_y, float approach_z)
|
---|
| 281 | {
|
---|
| 282 | #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
|
---|
| 283 | char *buf = (char *)msgbuf;
|
---|
| 284 | _mav_put_int32_t(buf, 0, latitude);
|
---|
| 285 | _mav_put_int32_t(buf, 4, longitude);
|
---|
| 286 | _mav_put_int32_t(buf, 8, altitude);
|
---|
| 287 | _mav_put_float(buf, 12, x);
|
---|
| 288 | _mav_put_float(buf, 16, y);
|
---|
| 289 | _mav_put_float(buf, 20, z);
|
---|
| 290 | _mav_put_float(buf, 40, approach_x);
|
---|
| 291 | _mav_put_float(buf, 44, approach_y);
|
---|
| 292 | _mav_put_float(buf, 48, approach_z);
|
---|
| 293 | _mav_put_uint8_t(buf, 52, target_system);
|
---|
| 294 | _mav_put_float_array(buf, 24, q, 4);
|
---|
| 295 | _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_SET_HOME_POSITION, buf, MAVLINK_MSG_ID_SET_HOME_POSITION_MIN_LEN, MAVLINK_MSG_ID_SET_HOME_POSITION_LEN, MAVLINK_MSG_ID_SET_HOME_POSITION_CRC);
|
---|
| 296 | #else
|
---|
| 297 | mavlink_set_home_position_t *packet = (mavlink_set_home_position_t *)msgbuf;
|
---|
| 298 | packet->latitude = latitude;
|
---|
| 299 | packet->longitude = longitude;
|
---|
| 300 | packet->altitude = altitude;
|
---|
| 301 | packet->x = x;
|
---|
| 302 | packet->y = y;
|
---|
| 303 | packet->z = z;
|
---|
| 304 | packet->approach_x = approach_x;
|
---|
| 305 | packet->approach_y = approach_y;
|
---|
| 306 | packet->approach_z = approach_z;
|
---|
| 307 | packet->target_system = target_system;
|
---|
| 308 | mav_array_memcpy(packet->q, q, sizeof(float)*4);
|
---|
| 309 | _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_SET_HOME_POSITION, (const char *)packet, MAVLINK_MSG_ID_SET_HOME_POSITION_MIN_LEN, MAVLINK_MSG_ID_SET_HOME_POSITION_LEN, MAVLINK_MSG_ID_SET_HOME_POSITION_CRC);
|
---|
| 310 | #endif
|
---|
| 311 | }
|
---|
| 312 | #endif
|
---|
| 313 |
|
---|
| 314 | #endif
|
---|
| 315 |
|
---|
| 316 | // MESSAGE SET_HOME_POSITION UNPACKING
|
---|
| 317 |
|
---|
| 318 |
|
---|
| 319 | /**
|
---|
| 320 | * @brief Get field target_system from set_home_position message
|
---|
| 321 | *
|
---|
| 322 | * @return System ID.
|
---|
| 323 | */
|
---|
| 324 | static inline uint8_t mavlink_msg_set_home_position_get_target_system(const mavlink_message_t* msg)
|
---|
| 325 | {
|
---|
| 326 | return _MAV_RETURN_uint8_t(msg, 52);
|
---|
| 327 | }
|
---|
| 328 |
|
---|
| 329 | /**
|
---|
| 330 | * @brief Get field latitude from set_home_position message
|
---|
| 331 | *
|
---|
| 332 | * @return Latitude (WGS84), in degrees * 1E7
|
---|
| 333 | */
|
---|
| 334 | static inline int32_t mavlink_msg_set_home_position_get_latitude(const mavlink_message_t* msg)
|
---|
| 335 | {
|
---|
| 336 | return _MAV_RETURN_int32_t(msg, 0);
|
---|
| 337 | }
|
---|
| 338 |
|
---|
| 339 | /**
|
---|
| 340 | * @brief Get field longitude from set_home_position message
|
---|
| 341 | *
|
---|
| 342 | * @return Longitude (WGS84, in degrees * 1E7
|
---|
| 343 | */
|
---|
| 344 | static inline int32_t mavlink_msg_set_home_position_get_longitude(const mavlink_message_t* msg)
|
---|
| 345 | {
|
---|
| 346 | return _MAV_RETURN_int32_t(msg, 4);
|
---|
| 347 | }
|
---|
| 348 |
|
---|
| 349 | /**
|
---|
| 350 | * @brief Get field altitude from set_home_position message
|
---|
| 351 | *
|
---|
| 352 | * @return Altitude (AMSL), in meters * 1000 (positive for up)
|
---|
| 353 | */
|
---|
| 354 | static inline int32_t mavlink_msg_set_home_position_get_altitude(const mavlink_message_t* msg)
|
---|
| 355 | {
|
---|
| 356 | return _MAV_RETURN_int32_t(msg, 8);
|
---|
| 357 | }
|
---|
| 358 |
|
---|
| 359 | /**
|
---|
| 360 | * @brief Get field x from set_home_position message
|
---|
| 361 | *
|
---|
| 362 | * @return Local X position of this position in the local coordinate frame
|
---|
| 363 | */
|
---|
| 364 | static inline float mavlink_msg_set_home_position_get_x(const mavlink_message_t* msg)
|
---|
| 365 | {
|
---|
| 366 | return _MAV_RETURN_float(msg, 12);
|
---|
| 367 | }
|
---|
| 368 |
|
---|
| 369 | /**
|
---|
| 370 | * @brief Get field y from set_home_position message
|
---|
| 371 | *
|
---|
| 372 | * @return Local Y position of this position in the local coordinate frame
|
---|
| 373 | */
|
---|
| 374 | static inline float mavlink_msg_set_home_position_get_y(const mavlink_message_t* msg)
|
---|
| 375 | {
|
---|
| 376 | return _MAV_RETURN_float(msg, 16);
|
---|
| 377 | }
|
---|
| 378 |
|
---|
| 379 | /**
|
---|
| 380 | * @brief Get field z from set_home_position message
|
---|
| 381 | *
|
---|
| 382 | * @return Local Z position of this position in the local coordinate frame
|
---|
| 383 | */
|
---|
| 384 | static inline float mavlink_msg_set_home_position_get_z(const mavlink_message_t* msg)
|
---|
| 385 | {
|
---|
| 386 | return _MAV_RETURN_float(msg, 20);
|
---|
| 387 | }
|
---|
| 388 |
|
---|
| 389 | /**
|
---|
| 390 | * @brief Get field q from set_home_position message
|
---|
| 391 | *
|
---|
| 392 | * @return World to surface normal and heading transformation of the takeoff position. Used to indicate the heading and slope of the ground
|
---|
| 393 | */
|
---|
| 394 | static inline uint16_t mavlink_msg_set_home_position_get_q(const mavlink_message_t* msg, float *q)
|
---|
| 395 | {
|
---|
| 396 | return _MAV_RETURN_float_array(msg, q, 4, 24);
|
---|
| 397 | }
|
---|
| 398 |
|
---|
| 399 | /**
|
---|
| 400 | * @brief Get field approach_x from set_home_position message
|
---|
| 401 | *
|
---|
| 402 | * @return Local X position of the end of the approach vector. Multicopters should set this position based on their takeoff path. Grass-landing fixed wing aircraft should set it the same way as multicopters. Runway-landing fixed wing aircraft should set it to the opposite direction of the takeoff, assuming the takeoff happened from the threshold / touchdown zone.
|
---|
| 403 | */
|
---|
| 404 | static inline float mavlink_msg_set_home_position_get_approach_x(const mavlink_message_t* msg)
|
---|
| 405 | {
|
---|
| 406 | return _MAV_RETURN_float(msg, 40);
|
---|
| 407 | }
|
---|
| 408 |
|
---|
| 409 | /**
|
---|
| 410 | * @brief Get field approach_y from set_home_position message
|
---|
| 411 | *
|
---|
| 412 | * @return Local Y position of the end of the approach vector. Multicopters should set this position based on their takeoff path. Grass-landing fixed wing aircraft should set it the same way as multicopters. Runway-landing fixed wing aircraft should set it to the opposite direction of the takeoff, assuming the takeoff happened from the threshold / touchdown zone.
|
---|
| 413 | */
|
---|
| 414 | static inline float mavlink_msg_set_home_position_get_approach_y(const mavlink_message_t* msg)
|
---|
| 415 | {
|
---|
| 416 | return _MAV_RETURN_float(msg, 44);
|
---|
| 417 | }
|
---|
| 418 |
|
---|
| 419 | /**
|
---|
| 420 | * @brief Get field approach_z from set_home_position message
|
---|
| 421 | *
|
---|
| 422 | * @return Local Z position of the end of the approach vector. Multicopters should set this position based on their takeoff path. Grass-landing fixed wing aircraft should set it the same way as multicopters. Runway-landing fixed wing aircraft should set it to the opposite direction of the takeoff, assuming the takeoff happened from the threshold / touchdown zone.
|
---|
| 423 | */
|
---|
| 424 | static inline float mavlink_msg_set_home_position_get_approach_z(const mavlink_message_t* msg)
|
---|
| 425 | {
|
---|
| 426 | return _MAV_RETURN_float(msg, 48);
|
---|
| 427 | }
|
---|
| 428 |
|
---|
| 429 | /**
|
---|
| 430 | * @brief Decode a set_home_position message into a struct
|
---|
| 431 | *
|
---|
| 432 | * @param msg The message to decode
|
---|
| 433 | * @param set_home_position C-struct to decode the message contents into
|
---|
| 434 | */
|
---|
| 435 | static inline void mavlink_msg_set_home_position_decode(const mavlink_message_t* msg, mavlink_set_home_position_t* set_home_position)
|
---|
| 436 | {
|
---|
| 437 | #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
|
---|
| 438 | set_home_position->latitude = mavlink_msg_set_home_position_get_latitude(msg);
|
---|
| 439 | set_home_position->longitude = mavlink_msg_set_home_position_get_longitude(msg);
|
---|
| 440 | set_home_position->altitude = mavlink_msg_set_home_position_get_altitude(msg);
|
---|
| 441 | set_home_position->x = mavlink_msg_set_home_position_get_x(msg);
|
---|
| 442 | set_home_position->y = mavlink_msg_set_home_position_get_y(msg);
|
---|
| 443 | set_home_position->z = mavlink_msg_set_home_position_get_z(msg);
|
---|
| 444 | mavlink_msg_set_home_position_get_q(msg, set_home_position->q);
|
---|
| 445 | set_home_position->approach_x = mavlink_msg_set_home_position_get_approach_x(msg);
|
---|
| 446 | set_home_position->approach_y = mavlink_msg_set_home_position_get_approach_y(msg);
|
---|
| 447 | set_home_position->approach_z = mavlink_msg_set_home_position_get_approach_z(msg);
|
---|
| 448 | set_home_position->target_system = mavlink_msg_set_home_position_get_target_system(msg);
|
---|
| 449 | #else
|
---|
| 450 | uint8_t len = msg->len < MAVLINK_MSG_ID_SET_HOME_POSITION_LEN? msg->len : MAVLINK_MSG_ID_SET_HOME_POSITION_LEN;
|
---|
| 451 | memset(set_home_position, 0, MAVLINK_MSG_ID_SET_HOME_POSITION_LEN);
|
---|
| 452 | memcpy(set_home_position, _MAV_PAYLOAD(msg), len);
|
---|
| 453 | #endif
|
---|
| 454 | }
|
---|