Commit 946acc18 authored by lm's avatar lm

Updated to MAVLink v1.0

parent 1dd78635
/** @file
* @brief MAVLink comm protocol.
* @see http://qgroundcontrol.org/mavlink/
* Generated on Wednesday, July 27 2011, 14:17 UTC
* Generated on Sunday, July 31 2011, 15:11 UTC
*/
#ifndef ARDUPILOTMEGA_H
#define ARDUPILOTMEGA_H
......@@ -33,13 +33,6 @@ extern "C" {
// MESSAGE DEFINITIONS
// MESSAGE LENGTHS
#undef MAVLINK_MESSAGE_LENGTHS
#define MAVLINK_MESSAGE_LENGTHS { 3, 4, 8, 14, 8, 28, 3, 32, 0, 2, 3, 2, 2, 0, 0, 0, 0, 0, 0, 0, 19, 2, 23, 21, 0, 37, 26, 101, 26, 16, 32, 32, 37, 32, 11, 17, 17, 16, 18, 36, 4, 4, 2, 2, 4, 2, 2, 3, 14, 12, 18, 16, 8, 27, 25, 0, 0, 0, 0, 0, 5, 5, 26, 16, 36, 5, 6, 0, 0, 21, 0, 0, 0, 18, 20, 20, 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 30, 14, 14, 51 }
#ifdef __cplusplus
}
#endif
......
/** @file
* @brief MAVLink comm protocol.
* @see http://pixhawk.ethz.ch/software/mavlink
* Generated on Wednesday, July 27 2011, 14:17 UTC
* Generated on Sunday, July 31 2011, 15:11 UTC
*/
#ifndef MAVLINK_H
#define MAVLINK_H
#pragma pack(push,1)
#include "ardupilotmega.h"
#ifdef MAVLINK_CHECK_LENGTH
#include "lengths.h"
#endif
#pragma pack(pop)
#endif
......@@ -34,6 +34,7 @@ static inline void crc_accumulate(uint8_t data, uint16_t *crcAccum)
tmp=data ^ (uint8_t)(*crcAccum &0xff);
tmp^= (tmp<<4);
*crcAccum = (*crcAccum>>8) ^ (tmp<<8) ^ (tmp <<3) ^ (tmp>>4);
// *crcAccum += data; // super simple to test
}
/**
......@@ -86,6 +87,49 @@ static inline uint16_t crc_calculate(uint8_t* pBuffer, int length)
}
/**
* @brief Calculates the X.25 checksum on a msg buffer
*
* @param pMSG buffer containing the msg to hash
* @param length number of bytes to hash
* @return the checksum over the buffer bytes
**/
static inline uint16_t crc_calculate_msg(mavlink_message_t* pMSG, int length)
{
// For a "message" of length bytes contained in the unsigned char array
// pointed to by pBuffer, calculate the CRC
// crcCalculate(unsigned char* pBuffer, int length, unsigned short* checkConst) < not needed
uint16_t crcTmp;
//uint16_t tmp;
uint8_t* pTmp;
int i;
pTmp=&pMSG->len;
/* init crcTmp */
crc_init(&crcTmp);
for (i = 0; i < 5; i++){
crc_accumulate(*pTmp++, &crcTmp);
}
pTmp=&pMSG->payload[0];
for (; i < length; i++){
crc_accumulate(*pTmp++, &crcTmp);
}
/* This is currently not needed, as only the checksum over payload should be computed
tmp = crcTmp;
crcAccumulate((unsigned char)(~crcTmp & 0xff),&tmp);
crcAccumulate((unsigned char)((~crcTmp>>8)&0xff),&tmp);
*checkConst = tmp;
*/
return(crcTmp);
}
#endif /* _CHECKSUM_H_ */
......
This diff is collapsed.
/** @file
* @brief MAVLink comm protocol.
* @see http://pixhawk.ethz.ch/software/mavlink
* Generated on Wednesday, July 27 2011, 14:17 UTC
* Generated on Sunday, July 31 2011, 15:12 UTC
*/
#ifndef MAVLINK_H
#define MAVLINK_H
#pragma pack(push,1)
#include "common.h"
#ifdef MAVLINK_CHECK_LENGTH
#include "lengths.h"
#endif
#pragma pack(pop)
#endif
// MESSAGE ACTION PACKING
#define MAVLINK_MSG_ID_ACTION 10
#define MAVLINK_MSG_ID_ACTION_LEN 3
#define MAVLINK_MSG_10_LEN 3
typedef struct __mavlink_action_t
{
......@@ -10,8 +12,6 @@ typedef struct __mavlink_action_t
} mavlink_action_t;
/**
* @brief Pack a action message
* @param system_id ID of this system
......@@ -25,14 +25,14 @@ typedef struct __mavlink_action_t
*/
static inline uint16_t mavlink_msg_action_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, uint8_t target, uint8_t target_component, uint8_t action)
{
uint16_t i = 0;
mavlink_action_t *p = (mavlink_action_t *)&msg->payload[0];
msg->msgid = MAVLINK_MSG_ID_ACTION;
i += put_uint8_t_by_index(target, i, msg->payload); // The system executing the action
i += put_uint8_t_by_index(target_component, i, msg->payload); // The component executing the action
i += put_uint8_t_by_index(action, i, msg->payload); // The action id
p->target = target; // uint8_t:The system executing the action
p->target_component = target_component; // uint8_t:The component executing the action
p->action = action; // uint8_t:The action id
return mavlink_finalize_message(msg, system_id, component_id, i);
return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_ACTION_LEN);
}
/**
......@@ -48,14 +48,14 @@ static inline uint16_t mavlink_msg_action_pack(uint8_t system_id, uint8_t compon
*/
static inline uint16_t mavlink_msg_action_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, uint8_t target, uint8_t target_component, uint8_t action)
{
uint16_t i = 0;
mavlink_action_t *p = (mavlink_action_t *)&msg->payload[0];
msg->msgid = MAVLINK_MSG_ID_ACTION;
i += put_uint8_t_by_index(target, i, msg->payload); // The system executing the action
i += put_uint8_t_by_index(target_component, i, msg->payload); // The component executing the action
i += put_uint8_t_by_index(action, i, msg->payload); // The action id
p->target = target; // uint8_t:The system executing the action
p->target_component = target_component; // uint8_t:The component executing the action
p->action = action; // uint8_t:The action id
return mavlink_finalize_message_chan(msg, system_id, component_id, chan, i);
return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_ACTION_LEN);
}
/**
......@@ -80,12 +80,61 @@ static inline uint16_t mavlink_msg_action_encode(uint8_t system_id, uint8_t comp
* @param action The action id
*/
#ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS
static inline void mavlink_msg_action_send(mavlink_channel_t chan, uint8_t target, uint8_t target_component, uint8_t action)
{
mavlink_message_t msg;
mavlink_msg_action_pack_chan(mavlink_system.sysid, mavlink_system.compid, chan, &msg, target, target_component, action);
mavlink_send_uart(chan, &msg);
uint16_t checksum;
mavlink_action_t *p = (mavlink_action_t *)&msg.payload[0];
p->target = target; // uint8_t:The system executing the action
p->target_component = target_component; // uint8_t:The component executing the action
p->action = action; // uint8_t:The action id
msg.STX = MAVLINK_STX;
msg.len = MAVLINK_MSG_ID_ACTION_LEN;
msg.msgid = MAVLINK_MSG_ID_ACTION;
msg.sysid = mavlink_system.sysid;
msg.compid = mavlink_system.compid;
msg.seq = mavlink_get_channel_status(chan)->current_tx_seq;
mavlink_get_channel_status(chan)->current_tx_seq = msg.seq + 1;
checksum = crc_calculate_msg(&msg, msg.len + MAVLINK_CORE_HEADER_LEN);
msg.ck_a = (uint8_t)(checksum & 0xFF); ///< Low byte
msg.ck_b = (uint8_t)(checksum >> 8); ///< High byte
mavlink_send_msg(chan, &msg);
}
#endif
#ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS_SMALL
static inline void mavlink_msg_action_send(mavlink_channel_t chan, uint8_t target, uint8_t target_component, uint8_t action)
{
mavlink_header_t hdr;
mavlink_action_t payload;
uint16_t checksum;
mavlink_action_t *p = &payload;
p->target = target; // uint8_t:The system executing the action
p->target_component = target_component; // uint8_t:The component executing the action
p->action = action; // uint8_t:The action id
hdr.STX = MAVLINK_STX;
hdr.len = MAVLINK_MSG_ID_ACTION_LEN;
hdr.msgid = MAVLINK_MSG_ID_ACTION;
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 );
crc_init(&checksum);
checksum = crc_calculate_mem((uint8_t *)&hdr.len, &checksum, MAVLINK_CORE_HEADER_LEN);
checksum = crc_calculate_mem((uint8_t *)&payload, &checksum, hdr.len );
hdr.ck_a = (uint8_t)(checksum & 0xFF); ///< Low byte
hdr.ck_b = (uint8_t)(checksum >> 8); ///< High byte
mavlink_send_mem(chan, (uint8_t *)&payload, hdr.len);
mavlink_send_mem(chan, (uint8_t *)&hdr.ck_a, MAVLINK_NUM_CHECKSUM_BYTES);
}
#endif
......@@ -98,7 +147,8 @@ static inline void mavlink_msg_action_send(mavlink_channel_t chan, uint8_t targe
*/
static inline uint8_t mavlink_msg_action_get_target(const mavlink_message_t* msg)
{
return (uint8_t)(msg->payload)[0];
mavlink_action_t *p = (mavlink_action_t *)&msg->payload[0];
return (uint8_t)(p->target);
}
/**
......@@ -108,7 +158,8 @@ static inline uint8_t mavlink_msg_action_get_target(const mavlink_message_t* msg
*/
static inline uint8_t mavlink_msg_action_get_target_component(const mavlink_message_t* msg)
{
return (uint8_t)(msg->payload+sizeof(uint8_t))[0];
mavlink_action_t *p = (mavlink_action_t *)&msg->payload[0];
return (uint8_t)(p->target_component);
}
/**
......@@ -118,7 +169,8 @@ static inline uint8_t mavlink_msg_action_get_target_component(const mavlink_mess
*/
static inline uint8_t mavlink_msg_action_get_action(const mavlink_message_t* msg)
{
return (uint8_t)(msg->payload+sizeof(uint8_t)+sizeof(uint8_t))[0];
mavlink_action_t *p = (mavlink_action_t *)&msg->payload[0];
return (uint8_t)(p->action);
}
/**
......@@ -129,7 +181,5 @@ static inline uint8_t mavlink_msg_action_get_action(const mavlink_message_t* msg
*/
static inline void mavlink_msg_action_decode(const mavlink_message_t* msg, mavlink_action_t* action)
{
action->target = mavlink_msg_action_get_target(msg);
action->target_component = mavlink_msg_action_get_target_component(msg);
action->action = mavlink_msg_action_get_action(msg);
memcpy( action, msg->payload, sizeof(mavlink_action_t));
}
// MESSAGE ACTION_ACK PACKING
#define MAVLINK_MSG_ID_ACTION_ACK 9
#define MAVLINK_MSG_ID_ACTION_ACK_LEN 2
#define MAVLINK_MSG_9_LEN 2
typedef struct __mavlink_action_ack_t
{
......@@ -9,8 +11,6 @@ typedef struct __mavlink_action_ack_t
} mavlink_action_ack_t;
/**
* @brief Pack a action_ack message
* @param system_id ID of this system
......@@ -23,13 +23,13 @@ typedef struct __mavlink_action_ack_t
*/
static inline uint16_t mavlink_msg_action_ack_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, uint8_t action, uint8_t result)
{
uint16_t i = 0;
mavlink_action_ack_t *p = (mavlink_action_ack_t *)&msg->payload[0];
msg->msgid = MAVLINK_MSG_ID_ACTION_ACK;
i += put_uint8_t_by_index(action, i, msg->payload); // The action id
i += put_uint8_t_by_index(result, i, msg->payload); // 0: Action DENIED, 1: Action executed
p->action = action; // uint8_t:The action id
p->result = result; // uint8_t:0: Action DENIED, 1: Action executed
return mavlink_finalize_message(msg, system_id, component_id, i);
return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_ACTION_ACK_LEN);
}
/**
......@@ -44,13 +44,13 @@ static inline uint16_t mavlink_msg_action_ack_pack(uint8_t system_id, uint8_t co
*/
static inline uint16_t mavlink_msg_action_ack_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, uint8_t action, uint8_t result)
{
uint16_t i = 0;
mavlink_action_ack_t *p = (mavlink_action_ack_t *)&msg->payload[0];
msg->msgid = MAVLINK_MSG_ID_ACTION_ACK;
i += put_uint8_t_by_index(action, i, msg->payload); // The action id
i += put_uint8_t_by_index(result, i, msg->payload); // 0: Action DENIED, 1: Action executed
p->action = action; // uint8_t:The action id
p->result = result; // uint8_t:0: Action DENIED, 1: Action executed
return mavlink_finalize_message_chan(msg, system_id, component_id, chan, i);
return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_ACTION_ACK_LEN);
}
/**
......@@ -74,12 +74,59 @@ static inline uint16_t mavlink_msg_action_ack_encode(uint8_t system_id, uint8_t
* @param result 0: Action DENIED, 1: Action executed
*/
#ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS
static inline void mavlink_msg_action_ack_send(mavlink_channel_t chan, uint8_t action, uint8_t result)
{
mavlink_message_t msg;
mavlink_msg_action_ack_pack_chan(mavlink_system.sysid, mavlink_system.compid, chan, &msg, action, result);
mavlink_send_uart(chan, &msg);
uint16_t checksum;
mavlink_action_ack_t *p = (mavlink_action_ack_t *)&msg.payload[0];
p->action = action; // uint8_t:The action id
p->result = result; // uint8_t:0: Action DENIED, 1: Action executed
msg.STX = MAVLINK_STX;
msg.len = MAVLINK_MSG_ID_ACTION_ACK_LEN;
msg.msgid = MAVLINK_MSG_ID_ACTION_ACK;
msg.sysid = mavlink_system.sysid;
msg.compid = mavlink_system.compid;
msg.seq = mavlink_get_channel_status(chan)->current_tx_seq;
mavlink_get_channel_status(chan)->current_tx_seq = msg.seq + 1;
checksum = crc_calculate_msg(&msg, msg.len + MAVLINK_CORE_HEADER_LEN);
msg.ck_a = (uint8_t)(checksum & 0xFF); ///< Low byte
msg.ck_b = (uint8_t)(checksum >> 8); ///< High byte
mavlink_send_msg(chan, &msg);
}
#endif
#ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS_SMALL
static inline void mavlink_msg_action_ack_send(mavlink_channel_t chan, uint8_t action, uint8_t result)
{
mavlink_header_t hdr;
mavlink_action_ack_t payload;
uint16_t checksum;
mavlink_action_ack_t *p = &payload;
p->action = action; // uint8_t:The action id
p->result = result; // uint8_t:0: Action DENIED, 1: Action executed
hdr.STX = MAVLINK_STX;
hdr.len = MAVLINK_MSG_ID_ACTION_ACK_LEN;
hdr.msgid = MAVLINK_MSG_ID_ACTION_ACK;
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 );
crc_init(&checksum);
checksum = crc_calculate_mem((uint8_t *)&hdr.len, &checksum, MAVLINK_CORE_HEADER_LEN);
checksum = crc_calculate_mem((uint8_t *)&payload, &checksum, hdr.len );
hdr.ck_a = (uint8_t)(checksum & 0xFF); ///< Low byte
hdr.ck_b = (uint8_t)(checksum >> 8); ///< High byte
mavlink_send_mem(chan, (uint8_t *)&payload, hdr.len);
mavlink_send_mem(chan, (uint8_t *)&hdr.ck_a, MAVLINK_NUM_CHECKSUM_BYTES);
}
#endif
......@@ -92,7 +139,8 @@ static inline void mavlink_msg_action_ack_send(mavlink_channel_t chan, uint8_t a
*/
static inline uint8_t mavlink_msg_action_ack_get_action(const mavlink_message_t* msg)
{
return (uint8_t)(msg->payload)[0];
mavlink_action_ack_t *p = (mavlink_action_ack_t *)&msg->payload[0];
return (uint8_t)(p->action);
}
/**
......@@ -102,7 +150,8 @@ static inline uint8_t mavlink_msg_action_ack_get_action(const mavlink_message_t*
*/
static inline uint8_t mavlink_msg_action_ack_get_result(const mavlink_message_t* msg)
{
return (uint8_t)(msg->payload+sizeof(uint8_t))[0];
mavlink_action_ack_t *p = (mavlink_action_ack_t *)&msg->payload[0];
return (uint8_t)(p->result);
}
/**
......@@ -113,6 +162,5 @@ static inline uint8_t mavlink_msg_action_ack_get_result(const mavlink_message_t*
*/
static inline void mavlink_msg_action_ack_decode(const mavlink_message_t* msg, mavlink_action_ack_t* action_ack)
{
action_ack->action = mavlink_msg_action_ack_get_action(msg);
action_ack->result = mavlink_msg_action_ack_get_result(msg);
memcpy( action_ack, msg->payload, sizeof(mavlink_action_ack_t));
}
// MESSAGE ATTITUDE_CONTROLLER_OUTPUT PACKING
#define MAVLINK_MSG_ID_ATTITUDE_CONTROLLER_OUTPUT 60
#define MAVLINK_MSG_ID_ATTITUDE_CONTROLLER_OUTPUT_LEN 5
#define MAVLINK_MSG_60_LEN 5
typedef struct __mavlink_attitude_controller_output_t
{
......@@ -12,8 +14,6 @@ typedef struct __mavlink_attitude_controller_output_t
} mavlink_attitude_controller_output_t;
/**
* @brief Pack a attitude_controller_output message
* @param system_id ID of this system
......@@ -29,16 +29,16 @@ typedef struct __mavlink_attitude_controller_output_t
*/
static inline uint16_t mavlink_msg_attitude_controller_output_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, uint8_t enabled, int8_t roll, int8_t pitch, int8_t yaw, int8_t thrust)
{
uint16_t i = 0;
mavlink_attitude_controller_output_t *p = (mavlink_attitude_controller_output_t *)&msg->payload[0];
msg->msgid = MAVLINK_MSG_ID_ATTITUDE_CONTROLLER_OUTPUT;
i += put_uint8_t_by_index(enabled, i, msg->payload); // 1: enabled, 0: disabled
i += put_int8_t_by_index(roll, i, msg->payload); // Attitude roll: -128: -100%, 127: +100%
i += put_int8_t_by_index(pitch, i, msg->payload); // Attitude pitch: -128: -100%, 127: +100%
i += put_int8_t_by_index(yaw, i, msg->payload); // Attitude yaw: -128: -100%, 127: +100%
i += put_int8_t_by_index(thrust, i, msg->payload); // Attitude thrust: -128: -100%, 127: +100%
p->enabled = enabled; // uint8_t:1: enabled, 0: disabled
p->roll = roll; // int8_t:Attitude roll: -128: -100%, 127: +100%
p->pitch = pitch; // int8_t:Attitude pitch: -128: -100%, 127: +100%
p->yaw = yaw; // int8_t:Attitude yaw: -128: -100%, 127: +100%
p->thrust = thrust; // int8_t:Attitude thrust: -128: -100%, 127: +100%
return mavlink_finalize_message(msg, system_id, component_id, i);
return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_ATTITUDE_CONTROLLER_OUTPUT_LEN);
}
/**
......@@ -56,16 +56,16 @@ static inline uint16_t mavlink_msg_attitude_controller_output_pack(uint8_t syste
*/
static inline uint16_t mavlink_msg_attitude_controller_output_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, uint8_t enabled, int8_t roll, int8_t pitch, int8_t yaw, int8_t thrust)
{
uint16_t i = 0;
mavlink_attitude_controller_output_t *p = (mavlink_attitude_controller_output_t *)&msg->payload[0];
msg->msgid = MAVLINK_MSG_ID_ATTITUDE_CONTROLLER_OUTPUT;
i += put_uint8_t_by_index(enabled, i, msg->payload); // 1: enabled, 0: disabled
i += put_int8_t_by_index(roll, i, msg->payload); // Attitude roll: -128: -100%, 127: +100%
i += put_int8_t_by_index(pitch, i, msg->payload); // Attitude pitch: -128: -100%, 127: +100%
i += put_int8_t_by_index(yaw, i, msg->payload); // Attitude yaw: -128: -100%, 127: +100%
i += put_int8_t_by_index(thrust, i, msg->payload); // Attitude thrust: -128: -100%, 127: +100%
p->enabled = enabled; // uint8_t:1: enabled, 0: disabled
p->roll = roll; // int8_t:Attitude roll: -128: -100%, 127: +100%
p->pitch = pitch; // int8_t:Attitude pitch: -128: -100%, 127: +100%
p->yaw = yaw; // int8_t:Attitude yaw: -128: -100%, 127: +100%
p->thrust = thrust; // int8_t:Attitude thrust: -128: -100%, 127: +100%
return mavlink_finalize_message_chan(msg, system_id, component_id, chan, i);
return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_ATTITUDE_CONTROLLER_OUTPUT_LEN);
}
/**
......@@ -92,12 +92,65 @@ static inline uint16_t mavlink_msg_attitude_controller_output_encode(uint8_t sys
* @param thrust Attitude thrust: -128: -100%, 127: +100%
*/
#ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS
static inline void mavlink_msg_attitude_controller_output_send(mavlink_channel_t chan, uint8_t enabled, int8_t roll, int8_t pitch, int8_t yaw, int8_t thrust)
{
mavlink_message_t msg;
mavlink_msg_attitude_controller_output_pack_chan(mavlink_system.sysid, mavlink_system.compid, chan, &msg, enabled, roll, pitch, yaw, thrust);
mavlink_send_uart(chan, &msg);
uint16_t checksum;
mavlink_attitude_controller_output_t *p = (mavlink_attitude_controller_output_t *)&msg.payload[0];
p->enabled = enabled; // uint8_t:1: enabled, 0: disabled
p->roll = roll; // int8_t:Attitude roll: -128: -100%, 127: +100%
p->pitch = pitch; // int8_t:Attitude pitch: -128: -100%, 127: +100%
p->yaw = yaw; // int8_t:Attitude yaw: -128: -100%, 127: +100%
p->thrust = thrust; // int8_t:Attitude thrust: -128: -100%, 127: +100%
msg.STX = MAVLINK_STX;
msg.len = MAVLINK_MSG_ID_ATTITUDE_CONTROLLER_OUTPUT_LEN;
msg.msgid = MAVLINK_MSG_ID_ATTITUDE_CONTROLLER_OUTPUT;
msg.sysid = mavlink_system.sysid;
msg.compid = mavlink_system.compid;
msg.seq = mavlink_get_channel_status(chan)->current_tx_seq;
mavlink_get_channel_status(chan)->current_tx_seq = msg.seq + 1;
checksum = crc_calculate_msg(&msg, msg.len + MAVLINK_CORE_HEADER_LEN);
msg.ck_a = (uint8_t)(checksum & 0xFF); ///< Low byte
msg.ck_b = (uint8_t)(checksum >> 8); ///< High byte
mavlink_send_msg(chan, &msg);
}
#endif
#ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS_SMALL
static inline void mavlink_msg_attitude_controller_output_send(mavlink_channel_t chan, uint8_t enabled, int8_t roll, int8_t pitch, int8_t yaw, int8_t thrust)
{
mavlink_header_t hdr;
mavlink_attitude_controller_output_t payload;
uint16_t checksum;
mavlink_attitude_controller_output_t *p = &payload;
p->enabled = enabled; // uint8_t:1: enabled, 0: disabled
p->roll = roll; // int8_t:Attitude roll: -128: -100%, 127: +100%
p->pitch = pitch; // int8_t:Attitude pitch: -128: -100%, 127: +100%
p->yaw = yaw; // int8_t:Attitude yaw: -128: -100%, 127: +100%
p->thrust = thrust; // int8_t:Attitude thrust: -128: -100%, 127: +100%
hdr.STX = MAVLINK_STX;
hdr.len = MAVLINK_MSG_ID_ATTITUDE_CONTROLLER_OUTPUT_LEN;
hdr.msgid = MAVLINK_MSG_ID_ATTITUDE_CONTROLLER_OUTPUT;
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 );
crc_init(&checksum);
checksum = crc_calculate_mem((uint8_t *)&hdr.len, &checksum, MAVLINK_CORE_HEADER_LEN);
checksum = crc_calculate_mem((uint8_t *)&payload, &checksum, hdr.len );
hdr.ck_a = (uint8_t)(checksum & 0xFF); ///< Low byte
hdr.ck_b = (uint8_t)(checksum >> 8); ///< High byte
mavlink_send_mem(chan, (uint8_t *)&payload, hdr.len);
mavlink_send_mem(chan, (uint8_t *)&hdr.ck_a, MAVLINK_NUM_CHECKSUM_BYTES);
}
#endif
......@@ -110,7 +163,8 @@ static inline void mavlink_msg_attitude_controller_output_send(mavlink_channel_t
*/
static inline uint8_t mavlink_msg_attitude_controller_output_get_enabled(const mavlink_message_t* msg)
{
return (uint8_t)(msg->payload)[0];
mavlink_attitude_controller_output_t *p = (mavlink_attitude_controller_output_t *)&msg->payload[0];
return (uint8_t)(p->enabled);
}
/**
......@@ -120,7 +174,8 @@ static inline uint8_t mavlink_msg_attitude_controller_output_get_enabled(const m
*/
static inline int8_t mavlink_msg_attitude_controller_output_get_roll(const mavlink_message_t* msg)
{
return (int8_t)(msg->payload+sizeof(uint8_t))[0];
mavlink_attitude_controller_output_t *p = (mavlink_attitude_controller_output_t *)&msg->payload[0];
return (int8_t)(p->roll);
}
/**
......@@ -130,7 +185,8 @@ static inline int8_t mavlink_msg_attitude_controller_output_get_roll(const mavli
*/
static inline int8_t mavlink_msg_attitude_controller_output_get_pitch(const mavlink_message_t* msg)
{
return (int8_t)(msg->payload+sizeof(uint8_t)+sizeof(int8_t))[0];
mavlink_attitude_controller_output_t *p = (mavlink_attitude_controller_output_t *)&msg->payload[0];
return (int8_t)(p->pitch);
}
/**
......@@ -140,7 +196,8 @@ static inline int8_t mavlink_msg_attitude_controller_output_get_pitch(const mavl
*/
static inline int8_t mavlink_msg_attitude_controller_output_get_yaw(const mavlink_message_t* msg)
{
return (int8_t)(msg->payload+sizeof(uint8_t)+sizeof(int8_t)+sizeof(int8_t))[0];
mavlink_attitude_controller_output_t *p = (mavlink_attitude_controller_output_t *)&msg->payload[0];
return (int8_t)(p->yaw);
}
/**
......@@ -150,7 +207,8 @@ static inline int8_t mavlink_msg_attitude_controller_output_get_yaw(const mavlin
*/
static inline int8_t mavlink_msg_attitude_controller_output_get_thrust(const mavlink_message_t* msg)
{
return (int8_t)(msg->payload+sizeof(uint8_t)+sizeof(int8_t)+sizeof(int8_t)+sizeof(int8_t))[0];
mavlink_attitude_controller_output_t *p = (mavlink_attitude_controller_output_t *)&msg->payload[0];
return (int8_t)(p->thrust);
}
/**
......@@ -161,9 +219,5 @@ static inline int8_t mavlink_msg_attitude_controller_output_get_thrust(const mav
*/
static inline void mavlink_msg_attitude_controller_output_decode(const mavlink_message_t* msg, mavlink_attitude_controller_output_t* attitude_controller_output)
{
attitude_controller_output->enabled = mavlink_msg_attitude_controller_output_get_enabled(msg);
attitude_controller_output->roll = mavlink_msg_attitude_controller_output_get_roll(msg);
attitude_controller_output->pitch = mavlink_msg_attitude_controller_output_get_pitch(msg);
attitude_controller_output->yaw = mavlink_msg_attitude_controller_output_get_yaw(msg);
attitude_controller_output->thrust = mavlink_msg_attitude_controller_output_get_thrust(msg);
memcpy( attitude_controller_output, msg->payload, sizeof(mavlink_attitude_controller_output_t));
}
// MESSAGE AUTH_KEY PACKING
#define MAVLINK_MSG_ID_AUTH_KEY 7
#define MAVLINK_MSG_ID_AUTH_KEY_LEN 32
#define MAVLINK_MSG_7_LEN 32
typedef struct __mavlink_auth_key_t
{
char key[32]; ///< key
} mavlink_auth_key_t;
#define MAVLINK_MSG_AUTH_KEY_FIELD_KEY_LEN 32
/**
* @brief Pack a auth_key message
* @param system_id ID of this system
......@@ -22,12 +22,12 @@ typedef struct __mavlink_auth_key_t
*/
static inline uint16_t mavlink_msg_auth_key_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const char* key)
{
uint16_t i = 0;
mavlink_auth_key_t *p = (mavlink_auth_key_t *)&msg->payload[0];
msg->msgid = MAVLINK_MSG_ID_AUTH_KEY;
i += put_array_by_index((const int8_t*)key, sizeof(char)*32, i, msg->payload); // key
memcpy(p->key, key, sizeof(p->key)); // char[32]:key
return mavlink_finalize_message(msg, system_id, component_id, i);
return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_AUTH_KEY_LEN);
}
/**
......@@ -41,12 +41,12 @@ static inline uint16_t mavlink_msg_auth_key_pack(uint8_t system_id, uint8_t comp
*/
static inline uint16_t mavlink_msg_auth_key_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, const char* key)
{
uint16_t i = 0;
mavlink_auth_key_t *p = (mavlink_auth_key_t *)&msg->payload[0];
msg->msgid = MAVLINK_MSG_ID_AUTH_KEY;
i += put_array_by_index((const int8_t*)key, sizeof(char)*32, i, msg->payload); // key
memcpy(p->key, key, sizeof(p->key)); // char[32]:key
return mavlink_finalize_message_chan(msg, system_id, component_id, chan, i);
return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_AUTH_KEY_LEN);
}
/**
......@@ -69,12 +69,57 @@ static inline uint16_t mavlink_msg_auth_key_encode(uint8_t system_id, uint8_t co
* @param key key
*/
#ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS
static inline void mavlink_msg_auth_key_send(mavlink_channel_t chan, const char* key)
{
mavlink_message_t msg;
mavlink_msg_auth_key_pack_chan(mavlink_system.sysid, mavlink_system.compid, chan, &msg, key);
mavlink_send_uart(chan, &msg);
uint16_t checksum;
mavlink_auth_key_t *p = (mavlink_auth_key_t *)&msg.payload[0];
memcpy(p->key, key, sizeof(p->key)); // char[32]:key
msg.STX = MAVLINK_STX;
msg.len = MAVLINK_MSG_ID_AUTH_KEY_LEN;
msg.msgid = MAVLINK_MSG_ID_AUTH_KEY;
msg.sysid = mavlink_system.sysid;
msg.compid = mavlink_system.compid;
msg.seq = mavlink_get_channel_status(chan)->current_tx_seq;
mavlink_get_channel_status(chan)->current_tx_seq = msg.seq + 1;
checksum = crc_calculate_msg(&msg, msg.len + MAVLINK_CORE_HEADER_LEN);
msg.ck_a = (uint8_t)(checksum & 0xFF); ///< Low byte
msg.ck_b = (uint8_t)(checksum >> 8); ///< High byte
mavlink_send_msg(chan, &msg);
}
#endif
#ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS_SMALL
static inline void mavlink_msg_auth_key_send(mavlink_channel_t chan, const char* key)
{
mavlink_header_t hdr;
mavlink_auth_key_t payload;
uint16_t checksum;
mavlink_auth_key_t *p = &payload;
memcpy(p->key, key, sizeof(p->key)); // char[32]:key
hdr.STX = MAVLINK_STX;
hdr.len = MAVLINK_MSG_ID_AUTH_KEY_LEN;
hdr.msgid = MAVLINK_MSG_ID_AUTH_KEY;
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 );
crc_init(&checksum);
checksum = crc_calculate_mem((uint8_t *)&hdr.len, &checksum, MAVLINK_CORE_HEADER_LEN);
checksum = crc_calculate_mem((uint8_t *)&payload, &checksum, hdr.len );
hdr.ck_a = (uint8_t)(checksum & 0xFF); ///< Low byte
hdr.ck_b = (uint8_t)(checksum >> 8); ///< High byte
mavlink_send_mem(chan, (uint8_t *)&payload, hdr.len);
mavlink_send_mem(chan, (uint8_t *)&hdr.ck_a, MAVLINK_NUM_CHECKSUM_BYTES);
}
#endif
......@@ -85,11 +130,12 @@ static inline void mavlink_msg_auth_key_send(mavlink_channel_t chan, const char*
*
* @return key
*/
static inline uint16_t mavlink_msg_auth_key_get_key(const mavlink_message_t* msg, char* r_data)
static inline uint16_t mavlink_msg_auth_key_get_key(const mavlink_message_t* msg, char* key)
{
mavlink_auth_key_t *p = (mavlink_auth_key_t *)&msg->payload[0];
memcpy(r_data, msg->payload, sizeof(char)*32);
return sizeof(char)*32;
memcpy(key, p->key, sizeof(p->key));
return sizeof(p->key);
}
/**
......@@ -100,5 +146,5 @@ static inline uint16_t mavlink_msg_auth_key_get_key(const mavlink_message_t* msg
*/
static inline void mavlink_msg_auth_key_decode(const mavlink_message_t* msg, mavlink_auth_key_t* auth_key)
{
mavlink_msg_auth_key_get_key(msg, auth_key->key);
memcpy( auth_key, msg->payload, sizeof(mavlink_auth_key_t));
}
// MESSAGE BOOT PACKING
#define MAVLINK_MSG_ID_BOOT 1
#define MAVLINK_MSG_ID_BOOT_LEN 4
#define MAVLINK_MSG_1_LEN 4
typedef struct __mavlink_boot_t
{
......@@ -8,8 +10,6 @@ typedef struct __mavlink_boot_t
} mavlink_boot_t;
/**
* @brief Pack a boot message
* @param system_id ID of this system
......@@ -21,12 +21,12 @@ typedef struct __mavlink_boot_t
*/
static inline uint16_t mavlink_msg_boot_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, uint32_t version)
{
uint16_t i = 0;
mavlink_boot_t *p = (mavlink_boot_t *)&msg->payload[0];
msg->msgid = MAVLINK_MSG_ID_BOOT;
i += put_uint32_t_by_index(version, i, msg->payload); // The onboard software version
p->version = version; // uint32_t:The onboard software version
return mavlink_finalize_message(msg, system_id, component_id, i);
return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_BOOT_LEN);
}
/**
......@@ -40,12 +40,12 @@ static inline uint16_t mavlink_msg_boot_pack(uint8_t system_id, uint8_t componen
*/
static inline uint16_t mavlink_msg_boot_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, uint32_t version)
{
uint16_t i = 0;
mavlink_boot_t *p = (mavlink_boot_t *)&msg->payload[0];
msg->msgid = MAVLINK_MSG_ID_BOOT;
i += put_uint32_t_by_index(version, i, msg->payload); // The onboard software version
p->version = version; // uint32_t:The onboard software version
return mavlink_finalize_message_chan(msg, system_id, component_id, chan, i);
return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_BOOT_LEN);
}
/**
......@@ -68,12 +68,57 @@ static inline uint16_t mavlink_msg_boot_encode(uint8_t system_id, uint8_t compon
* @param version The onboard software version
*/
#ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS
static inline void mavlink_msg_boot_send(mavlink_channel_t chan, uint32_t version)
{
mavlink_message_t msg;
mavlink_msg_boot_pack_chan(mavlink_system.sysid, mavlink_system.compid, chan, &msg, version);
mavlink_send_uart(chan, &msg);
uint16_t checksum;
mavlink_boot_t *p = (mavlink_boot_t *)&msg.payload[0];
p->version = version; // uint32_t:The onboard software version
msg.STX = MAVLINK_STX;
msg.len = MAVLINK_MSG_ID_BOOT_LEN;
msg.msgid = MAVLINK_MSG_ID_BOOT;
msg.sysid = mavlink_system.sysid;
msg.compid = mavlink_system.compid;
msg.seq = mavlink_get_channel_status(chan)->current_tx_seq;
mavlink_get_channel_status(chan)->current_tx_seq = msg.seq + 1;
checksum = crc_calculate_msg(&msg, msg.len + MAVLINK_CORE_HEADER_LEN);
msg.ck_a = (uint8_t)(checksum & 0xFF); ///< Low byte
msg.ck_b = (uint8_t)(checksum >> 8); ///< High byte
mavlink_send_msg(chan, &msg);
}
#endif
#ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS_SMALL
static inline void mavlink_msg_boot_send(mavlink_channel_t chan, uint32_t version)
{
mavlink_header_t hdr;
mavlink_boot_t payload;
uint16_t checksum;
mavlink_boot_t *p = &payload;
p->version = version; // uint32_t:The onboard software version
hdr.STX = MAVLINK_STX;
hdr.len = MAVLINK_MSG_ID_BOOT_LEN;
hdr.msgid = MAVLINK_MSG_ID_BOOT;
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 );
crc_init(&checksum);
checksum = crc_calculate_mem((uint8_t *)&hdr.len, &checksum, MAVLINK_CORE_HEADER_LEN);
checksum = crc_calculate_mem((uint8_t *)&payload, &checksum, hdr.len );
hdr.ck_a = (uint8_t)(checksum & 0xFF); ///< Low byte
hdr.ck_b = (uint8_t)(checksum >> 8); ///< High byte
mavlink_send_mem(chan, (uint8_t *)&payload, hdr.len);
mavlink_send_mem(chan, (uint8_t *)&hdr.ck_a, MAVLINK_NUM_CHECKSUM_BYTES);
}
#endif
......@@ -86,12 +131,8 @@ static inline void mavlink_msg_boot_send(mavlink_channel_t chan, uint32_t versio
*/
static inline uint32_t mavlink_msg_boot_get_version(const mavlink_message_t* msg)
{
generic_32bit r;
r.b[3] = (msg->payload)[0];
r.b[2] = (msg->payload)[1];
r.b[1] = (msg->payload)[2];
r.b[0] = (msg->payload)[3];
return (uint32_t)r.i;
mavlink_boot_t *p = (mavlink_boot_t *)&msg->payload[0];
return (uint32_t)(p->version);
}
/**
......@@ -102,5 +143,5 @@ static inline uint32_t mavlink_msg_boot_get_version(const mavlink_message_t* msg
*/
static inline void mavlink_msg_boot_decode(const mavlink_message_t* msg, mavlink_boot_t* boot)
{
boot->version = mavlink_msg_boot_get_version(msg);
memcpy( boot, msg->payload, sizeof(mavlink_boot_t));
}
// MESSAGE CHANGE_OPERATOR_CONTROL_ACK PACKING
#define MAVLINK_MSG_ID_CHANGE_OPERATOR_CONTROL_ACK 6
#define MAVLINK_MSG_ID_CHANGE_OPERATOR_CONTROL_ACK_LEN 3
#define MAVLINK_MSG_6_LEN 3
typedef struct __mavlink_change_operator_control_ack_t
{
......@@ -10,8 +12,6 @@ typedef struct __mavlink_change_operator_control_ack_t
} mavlink_change_operator_control_ack_t;
/**
* @brief Pack a change_operator_control_ack message
* @param system_id ID of this system
......@@ -25,14 +25,14 @@ typedef struct __mavlink_change_operator_control_ack_t
*/
static inline uint16_t mavlink_msg_change_operator_control_ack_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, uint8_t gcs_system_id, uint8_t control_request, uint8_t ack)
{
uint16_t i = 0;
mavlink_change_operator_control_ack_t *p = (mavlink_change_operator_control_ack_t *)&msg->payload[0];
msg->msgid = MAVLINK_MSG_ID_CHANGE_OPERATOR_CONTROL_ACK;
i += put_uint8_t_by_index(gcs_system_id, i, msg->payload); // ID of the GCS this message
i += put_uint8_t_by_index(control_request, i, msg->payload); // 0: request control of this MAV, 1: Release control of this MAV
i += put_uint8_t_by_index(ack, i, msg->payload); // 0: ACK, 1: NACK: Wrong passkey, 2: NACK: Unsupported passkey encryption method, 3: NACK: Already under control
p->gcs_system_id = gcs_system_id; // uint8_t:ID of the GCS this message
p->control_request = control_request; // uint8_t:0: request control of this MAV, 1: Release control of this MAV
p->ack = ack; // uint8_t:0: ACK, 1: NACK: Wrong passkey, 2: NACK: Unsupported passkey encryption method, 3: NACK: Already under control
return mavlink_finalize_message(msg, system_id, component_id, i);
return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_CHANGE_OPERATOR_CONTROL_ACK_LEN);
}
/**
......@@ -48,14 +48,14 @@ static inline uint16_t mavlink_msg_change_operator_control_ack_pack(uint8_t syst
*/
static inline uint16_t mavlink_msg_change_operator_control_ack_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, uint8_t gcs_system_id, uint8_t control_request, uint8_t ack)
{
uint16_t i = 0;
mavlink_change_operator_control_ack_t *p = (mavlink_change_operator_control_ack_t *)&msg->payload[0];
msg->msgid = MAVLINK_MSG_ID_CHANGE_OPERATOR_CONTROL_ACK;
i += put_uint8_t_by_index(gcs_system_id, i, msg->payload); // ID of the GCS this message
i += put_uint8_t_by_index(control_request, i, msg->payload); // 0: request control of this MAV, 1: Release control of this MAV
i += put_uint8_t_by_index(ack, i, msg->payload); // 0: ACK, 1: NACK: Wrong passkey, 2: NACK: Unsupported passkey encryption method, 3: NACK: Already under control
p->gcs_system_id = gcs_system_id; // uint8_t:ID of the GCS this message
p->control_request = control_request; // uint8_t:0: request control of this MAV, 1: Release control of this MAV
p->ack = ack; // uint8_t:0: ACK, 1: NACK: Wrong passkey, 2: NACK: Unsupported passkey encryption method, 3: NACK: Already under control
return mavlink_finalize_message_chan(msg, system_id, component_id, chan, i);
return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_CHANGE_OPERATOR_CONTROL_ACK_LEN);
}
/**
......@@ -80,12 +80,61 @@ static inline uint16_t mavlink_msg_change_operator_control_ack_encode(uint8_t sy
* @param ack 0: ACK, 1: NACK: Wrong passkey, 2: NACK: Unsupported passkey encryption method, 3: NACK: Already under control
*/
#ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS
static inline void mavlink_msg_change_operator_control_ack_send(mavlink_channel_t chan, uint8_t gcs_system_id, uint8_t control_request, uint8_t ack)
{
mavlink_message_t msg;
mavlink_msg_change_operator_control_ack_pack_chan(mavlink_system.sysid, mavlink_system.compid, chan, &msg, gcs_system_id, control_request, ack);
mavlink_send_uart(chan, &msg);
uint16_t checksum;
mavlink_change_operator_control_ack_t *p = (mavlink_change_operator_control_ack_t *)&msg.payload[0];
p->gcs_system_id = gcs_system_id; // uint8_t:ID of the GCS this message
p->control_request = control_request; // uint8_t:0: request control of this MAV, 1: Release control of this MAV
p->ack = ack; // uint8_t:0: ACK, 1: NACK: Wrong passkey, 2: NACK: Unsupported passkey encryption method, 3: NACK: Already under control
msg.STX = MAVLINK_STX;
msg.len = MAVLINK_MSG_ID_CHANGE_OPERATOR_CONTROL_ACK_LEN;
msg.msgid = MAVLINK_MSG_ID_CHANGE_OPERATOR_CONTROL_ACK;
msg.sysid = mavlink_system.sysid;
msg.compid = mavlink_system.compid;
msg.seq = mavlink_get_channel_status(chan)->current_tx_seq;
mavlink_get_channel_status(chan)->current_tx_seq = msg.seq + 1;
checksum = crc_calculate_msg(&msg, msg.len + MAVLINK_CORE_HEADER_LEN);
msg.ck_a = (uint8_t)(checksum & 0xFF); ///< Low byte
msg.ck_b = (uint8_t)(checksum >> 8); ///< High byte
mavlink_send_msg(chan, &msg);
}
#endif
#ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS_SMALL
static inline void mavlink_msg_change_operator_control_ack_send(mavlink_channel_t chan, uint8_t gcs_system_id, uint8_t control_request, uint8_t ack)
{
mavlink_header_t hdr;
mavlink_change_operator_control_ack_t payload;
uint16_t checksum;
mavlink_change_operator_control_ack_t *p = &payload;
p->gcs_system_id = gcs_system_id; // uint8_t:ID of the GCS this message
p->control_request = control_request; // uint8_t:0: request control of this MAV, 1: Release control of this MAV
p->ack = ack; // uint8_t:0: ACK, 1: NACK: Wrong passkey, 2: NACK: Unsupported passkey encryption method, 3: NACK: Already under control
hdr.STX = MAVLINK_STX;
hdr.len = MAVLINK_MSG_ID_CHANGE_OPERATOR_CONTROL_ACK_LEN;
hdr.msgid = MAVLINK_MSG_ID_CHANGE_OPERATOR_CONTROL_ACK;
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 );
crc_init(&checksum);
checksum = crc_calculate_mem((uint8_t *)&hdr.len, &checksum, MAVLINK_CORE_HEADER_LEN);
checksum = crc_calculate_mem((uint8_t *)&payload, &checksum, hdr.len );
hdr.ck_a = (uint8_t)(checksum & 0xFF); ///< Low byte
hdr.ck_b = (uint8_t)(checksum >> 8); ///< High byte
mavlink_send_mem(chan, (uint8_t *)&payload, hdr.len);
mavlink_send_mem(chan, (uint8_t *)&hdr.ck_a, MAVLINK_NUM_CHECKSUM_BYTES);
}
#endif
......@@ -98,7 +147,8 @@ static inline void mavlink_msg_change_operator_control_ack_send(mavlink_channel_
*/
static inline uint8_t mavlink_msg_change_operator_control_ack_get_gcs_system_id(const mavlink_message_t* msg)
{
return (uint8_t)(msg->payload)[0];
mavlink_change_operator_control_ack_t *p = (mavlink_change_operator_control_ack_t *)&msg->payload[0];
return (uint8_t)(p->gcs_system_id);
}
/**
......@@ -108,7 +158,8 @@ static inline uint8_t mavlink_msg_change_operator_control_ack_get_gcs_system_id(
*/
static inline uint8_t mavlink_msg_change_operator_control_ack_get_control_request(const mavlink_message_t* msg)
{
return (uint8_t)(msg->payload+sizeof(uint8_t))[0];
mavlink_change_operator_control_ack_t *p = (mavlink_change_operator_control_ack_t *)&msg->payload[0];
return (uint8_t)(p->control_request);
}
/**
......@@ -118,7 +169,8 @@ static inline uint8_t mavlink_msg_change_operator_control_ack_get_control_reques
*/
static inline uint8_t mavlink_msg_change_operator_control_ack_get_ack(const mavlink_message_t* msg)
{
return (uint8_t)(msg->payload+sizeof(uint8_t)+sizeof(uint8_t))[0];
mavlink_change_operator_control_ack_t *p = (mavlink_change_operator_control_ack_t *)&msg->payload[0];
return (uint8_t)(p->ack);
}
/**
......@@ -129,7 +181,5 @@ static inline uint8_t mavlink_msg_change_operator_control_ack_get_ack(const mavl
*/
static inline void mavlink_msg_change_operator_control_ack_decode(const mavlink_message_t* msg, mavlink_change_operator_control_ack_t* change_operator_control_ack)
{
change_operator_control_ack->gcs_system_id = mavlink_msg_change_operator_control_ack_get_gcs_system_id(msg);
change_operator_control_ack->control_request = mavlink_msg_change_operator_control_ack_get_control_request(msg);
change_operator_control_ack->ack = mavlink_msg_change_operator_control_ack_get_ack(msg);
memcpy( change_operator_control_ack, msg->payload, sizeof(mavlink_change_operator_control_ack_t));
}
// MESSAGE COMMAND_ACK PACKING
#define MAVLINK_MSG_ID_COMMAND_ACK 76
#define MAVLINK_MSG_ID_COMMAND_ACK_LEN 8
#define MAVLINK_MSG_76_LEN 8
typedef struct __mavlink_command_ack_t
{
......@@ -9,8 +11,6 @@ typedef struct __mavlink_command_ack_t
} mavlink_command_ack_t;
/**
* @brief Pack a command_ack message
* @param system_id ID of this system
......@@ -23,13 +23,13 @@ typedef struct __mavlink_command_ack_t
*/
static inline uint16_t mavlink_msg_command_ack_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, float command, float result)
{
uint16_t i = 0;
mavlink_command_ack_t *p = (mavlink_command_ack_t *)&msg->payload[0];
msg->msgid = MAVLINK_MSG_ID_COMMAND_ACK;
i += put_float_by_index(command, i, msg->payload); // Current airspeed in m/s
i += put_float_by_index(result, i, msg->payload); // 1: Action ACCEPTED and EXECUTED, 1: Action TEMPORARY REJECTED/DENIED, 2: Action PERMANENTLY DENIED, 3: Action UNKNOWN/UNSUPPORTED, 4: Requesting CONFIRMATION
p->command = command; // float:Current airspeed in m/s
p->result = result; // float:1: Action ACCEPTED and EXECUTED, 1: Action TEMPORARY REJECTED/DENIED, 2: Action PERMANENTLY DENIED, 3: Action UNKNOWN/UNSUPPORTED, 4: Requesting CONFIRMATION
return mavlink_finalize_message(msg, system_id, component_id, i);
return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_COMMAND_ACK_LEN);
}
/**
......@@ -44,13 +44,13 @@ static inline uint16_t mavlink_msg_command_ack_pack(uint8_t system_id, uint8_t c
*/
static inline uint16_t mavlink_msg_command_ack_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, float command, float result)
{
uint16_t i = 0;
mavlink_command_ack_t *p = (mavlink_command_ack_t *)&msg->payload[0];
msg->msgid = MAVLINK_MSG_ID_COMMAND_ACK;
i += put_float_by_index(command, i, msg->payload); // Current airspeed in m/s
i += put_float_by_index(result, i, msg->payload); // 1: Action ACCEPTED and EXECUTED, 1: Action TEMPORARY REJECTED/DENIED, 2: Action PERMANENTLY DENIED, 3: Action UNKNOWN/UNSUPPORTED, 4: Requesting CONFIRMATION
p->command = command; // float:Current airspeed in m/s
p->result = result; // float:1: Action ACCEPTED and EXECUTED, 1: Action TEMPORARY REJECTED/DENIED, 2: Action PERMANENTLY DENIED, 3: Action UNKNOWN/UNSUPPORTED, 4: Requesting CONFIRMATION
return mavlink_finalize_message_chan(msg, system_id, component_id, chan, i);
return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_COMMAND_ACK_LEN);
}
/**
......@@ -74,12 +74,59 @@ static inline uint16_t mavlink_msg_command_ack_encode(uint8_t system_id, uint8_t
* @param result 1: Action ACCEPTED and EXECUTED, 1: Action TEMPORARY REJECTED/DENIED, 2: Action PERMANENTLY DENIED, 3: Action UNKNOWN/UNSUPPORTED, 4: Requesting CONFIRMATION
*/
#ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS
static inline void mavlink_msg_command_ack_send(mavlink_channel_t chan, float command, float result)
{
mavlink_message_t msg;
mavlink_msg_command_ack_pack_chan(mavlink_system.sysid, mavlink_system.compid, chan, &msg, command, result);
mavlink_send_uart(chan, &msg);
uint16_t checksum;
mavlink_command_ack_t *p = (mavlink_command_ack_t *)&msg.payload[0];
p->command = command; // float:Current airspeed in m/s
p->result = result; // float:1: Action ACCEPTED and EXECUTED, 1: Action TEMPORARY REJECTED/DENIED, 2: Action PERMANENTLY DENIED, 3: Action UNKNOWN/UNSUPPORTED, 4: Requesting CONFIRMATION
msg.STX = MAVLINK_STX;
msg.len = MAVLINK_MSG_ID_COMMAND_ACK_LEN;
msg.msgid = MAVLINK_MSG_ID_COMMAND_ACK;
msg.sysid = mavlink_system.sysid;
msg.compid = mavlink_system.compid;
msg.seq = mavlink_get_channel_status(chan)->current_tx_seq;
mavlink_get_channel_status(chan)->current_tx_seq = msg.seq + 1;
checksum = crc_calculate_msg(&msg, msg.len + MAVLINK_CORE_HEADER_LEN);
msg.ck_a = (uint8_t)(checksum & 0xFF); ///< Low byte
msg.ck_b = (uint8_t)(checksum >> 8); ///< High byte
mavlink_send_msg(chan, &msg);
}
#endif
#ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS_SMALL
static inline void mavlink_msg_command_ack_send(mavlink_channel_t chan, float command, float result)
{
mavlink_header_t hdr;
mavlink_command_ack_t payload;
uint16_t checksum;
mavlink_command_ack_t *p = &payload;
p->command = command; // float:Current airspeed in m/s
p->result = result; // float:1: Action ACCEPTED and EXECUTED, 1: Action TEMPORARY REJECTED/DENIED, 2: Action PERMANENTLY DENIED, 3: Action UNKNOWN/UNSUPPORTED, 4: Requesting CONFIRMATION
hdr.STX = MAVLINK_STX;
hdr.len = MAVLINK_MSG_ID_COMMAND_ACK_LEN;
hdr.msgid = MAVLINK_MSG_ID_COMMAND_ACK;
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 );
crc_init(&checksum);
checksum = crc_calculate_mem((uint8_t *)&hdr.len, &checksum, MAVLINK_CORE_HEADER_LEN);
checksum = crc_calculate_mem((uint8_t *)&payload, &checksum, hdr.len );
hdr.ck_a = (uint8_t)(checksum & 0xFF); ///< Low byte
hdr.ck_b = (uint8_t)(checksum >> 8); ///< High byte
mavlink_send_mem(chan, (uint8_t *)&payload, hdr.len);
mavlink_send_mem(chan, (uint8_t *)&hdr.ck_a, MAVLINK_NUM_CHECKSUM_BYTES);
}
#endif
......@@ -92,12 +139,8 @@ static inline void mavlink_msg_command_ack_send(mavlink_channel_t chan, float co
*/
static inline float mavlink_msg_command_ack_get_command(const mavlink_message_t* msg)
{
generic_32bit r;
r.b[3] = (msg->payload)[0];
r.b[2] = (msg->payload)[1];
r.b[1] = (msg->payload)[2];
r.b[0] = (msg->payload)[3];
return (float)r.f;
mavlink_command_ack_t *p = (mavlink_command_ack_t *)&msg->payload[0];
return (float)(p->command);
}
/**
......@@ -107,12 +150,8 @@ static inline float mavlink_msg_command_ack_get_command(const mavlink_message_t*
*/
static inline float mavlink_msg_command_ack_get_result(const mavlink_message_t* msg)
{
generic_32bit r;
r.b[3] = (msg->payload+sizeof(float))[0];
r.b[2] = (msg->payload+sizeof(float))[1];
r.b[1] = (msg->payload+sizeof(float))[2];
r.b[0] = (msg->payload+sizeof(float))[3];
return (float)r.f;
mavlink_command_ack_t *p = (mavlink_command_ack_t *)&msg->payload[0];
return (float)(p->result);
}
/**
......@@ -123,6 +162,5 @@ static inline float mavlink_msg_command_ack_get_result(const mavlink_message_t*
*/
static inline void mavlink_msg_command_ack_decode(const mavlink_message_t* msg, mavlink_command_ack_t* command_ack)
{
command_ack->command = mavlink_msg_command_ack_get_command(msg);
command_ack->result = mavlink_msg_command_ack_get_result(msg);
memcpy( command_ack, msg->payload, sizeof(mavlink_command_ack_t));
}
// MESSAGE DEBUG PACKING
#define MAVLINK_MSG_ID_DEBUG 255
#define MAVLINK_MSG_ID_DEBUG_LEN 5
#define MAVLINK_MSG_255_LEN 5
typedef struct __mavlink_debug_t
{
......@@ -9,8 +11,6 @@ typedef struct __mavlink_debug_t
} mavlink_debug_t;
/**
* @brief Pack a debug message
* @param system_id ID of this system
......@@ -23,13 +23,13 @@ typedef struct __mavlink_debug_t
*/
static inline uint16_t mavlink_msg_debug_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, uint8_t ind, float value)
{
uint16_t i = 0;
mavlink_debug_t *p = (mavlink_debug_t *)&msg->payload[0];
msg->msgid = MAVLINK_MSG_ID_DEBUG;
i += put_uint8_t_by_index(ind, i, msg->payload); // index of debug variable
i += put_float_by_index(value, i, msg->payload); // DEBUG value
p->ind = ind; // uint8_t:index of debug variable
p->value = value; // float:DEBUG value
return mavlink_finalize_message(msg, system_id, component_id, i);
return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_DEBUG_LEN);
}
/**
......@@ -44,13 +44,13 @@ static inline uint16_t mavlink_msg_debug_pack(uint8_t system_id, uint8_t compone
*/
static inline uint16_t mavlink_msg_debug_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, uint8_t ind, float value)
{
uint16_t i = 0;
mavlink_debug_t *p = (mavlink_debug_t *)&msg->payload[0];
msg->msgid = MAVLINK_MSG_ID_DEBUG;
i += put_uint8_t_by_index(ind, i, msg->payload); // index of debug variable
i += put_float_by_index(value, i, msg->payload); // DEBUG value
p->ind = ind; // uint8_t:index of debug variable
p->value = value; // float:DEBUG value
return mavlink_finalize_message_chan(msg, system_id, component_id, chan, i);
return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_DEBUG_LEN);
}
/**
......@@ -74,12 +74,59 @@ static inline uint16_t mavlink_msg_debug_encode(uint8_t system_id, uint8_t compo
* @param value DEBUG value
*/
#ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS
static inline void mavlink_msg_debug_send(mavlink_channel_t chan, uint8_t ind, float value)
{
mavlink_message_t msg;
mavlink_msg_debug_pack_chan(mavlink_system.sysid, mavlink_system.compid, chan, &msg, ind, value);
mavlink_send_uart(chan, &msg);
uint16_t checksum;
mavlink_debug_t *p = (mavlink_debug_t *)&msg.payload[0];
p->ind = ind; // uint8_t:index of debug variable
p->value = value; // float:DEBUG value
msg.STX = MAVLINK_STX;
msg.len = MAVLINK_MSG_ID_DEBUG_LEN;
msg.msgid = MAVLINK_MSG_ID_DEBUG;
msg.sysid = mavlink_system.sysid;
msg.compid = mavlink_system.compid;
msg.seq = mavlink_get_channel_status(chan)->current_tx_seq;
mavlink_get_channel_status(chan)->current_tx_seq = msg.seq + 1;
checksum = crc_calculate_msg(&msg, msg.len + MAVLINK_CORE_HEADER_LEN);
msg.ck_a = (uint8_t)(checksum & 0xFF); ///< Low byte
msg.ck_b = (uint8_t)(checksum >> 8); ///< High byte
mavlink_send_msg(chan, &msg);
}
#endif
#ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS_SMALL
static inline void mavlink_msg_debug_send(mavlink_channel_t chan, uint8_t ind, float value)
{
mavlink_header_t hdr;
mavlink_debug_t payload;
uint16_t checksum;
mavlink_debug_t *p = &payload;
p->ind = ind; // uint8_t:index of debug variable
p->value = value; // float:DEBUG value
hdr.STX = MAVLINK_STX;
hdr.len = MAVLINK_MSG_ID_DEBUG_LEN;
hdr.msgid = MAVLINK_MSG_ID_DEBUG;
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 );
crc_init(&checksum);
checksum = crc_calculate_mem((uint8_t *)&hdr.len, &checksum, MAVLINK_CORE_HEADER_LEN);
checksum = crc_calculate_mem((uint8_t *)&payload, &checksum, hdr.len );
hdr.ck_a = (uint8_t)(checksum & 0xFF); ///< Low byte
hdr.ck_b = (uint8_t)(checksum >> 8); ///< High byte
mavlink_send_mem(chan, (uint8_t *)&payload, hdr.len);
mavlink_send_mem(chan, (uint8_t *)&hdr.ck_a, MAVLINK_NUM_CHECKSUM_BYTES);
}
#endif
......@@ -92,7 +139,8 @@ static inline void mavlink_msg_debug_send(mavlink_channel_t chan, uint8_t ind, f
*/
static inline uint8_t mavlink_msg_debug_get_ind(const mavlink_message_t* msg)
{
return (uint8_t)(msg->payload)[0];
mavlink_debug_t *p = (mavlink_debug_t *)&msg->payload[0];
return (uint8_t)(p->ind);
}
/**
......@@ -102,12 +150,8 @@ static inline uint8_t mavlink_msg_debug_get_ind(const mavlink_message_t* msg)
*/
static inline float mavlink_msg_debug_get_value(const mavlink_message_t* msg)
{
generic_32bit r;
r.b[3] = (msg->payload+sizeof(uint8_t))[0];
r.b[2] = (msg->payload+sizeof(uint8_t))[1];
r.b[1] = (msg->payload+sizeof(uint8_t))[2];
r.b[0] = (msg->payload+sizeof(uint8_t))[3];
return (float)r.f;
mavlink_debug_t *p = (mavlink_debug_t *)&msg->payload[0];
return (float)(p->value);
}
/**
......@@ -118,6 +162,5 @@ static inline float mavlink_msg_debug_get_value(const mavlink_message_t* msg)
*/
static inline void mavlink_msg_debug_decode(const mavlink_message_t* msg, mavlink_debug_t* debug)
{
debug->ind = mavlink_msg_debug_get_ind(msg);
debug->value = mavlink_msg_debug_get_value(msg);
memcpy( debug, msg->payload, sizeof(mavlink_debug_t));
}
// MESSAGE DEBUG_VECT PACKING
#define MAVLINK_MSG_ID_DEBUG_VECT 251
#define MAVLINK_MSG_ID_DEBUG_VECT_LEN 30
#define MAVLINK_MSG_251_LEN 30
typedef struct __mavlink_debug_vect_t
{
......@@ -11,10 +13,8 @@ typedef struct __mavlink_debug_vect_t
float z; ///< z
} mavlink_debug_vect_t;
#define MAVLINK_MSG_DEBUG_VECT_FIELD_NAME_LEN 10
/**
* @brief Pack a debug_vect message
* @param system_id ID of this system
......@@ -30,16 +30,16 @@ typedef struct __mavlink_debug_vect_t
*/
static inline uint16_t mavlink_msg_debug_vect_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const char* name, uint64_t usec, float x, float y, float z)
{
uint16_t i = 0;
mavlink_debug_vect_t *p = (mavlink_debug_vect_t *)&msg->payload[0];
msg->msgid = MAVLINK_MSG_ID_DEBUG_VECT;
i += put_array_by_index((const int8_t*)name, sizeof(char)*10, i, msg->payload); // Name
i += put_uint64_t_by_index(usec, i, msg->payload); // Timestamp
i += put_float_by_index(x, i, msg->payload); // x
i += put_float_by_index(y, i, msg->payload); // y
i += put_float_by_index(z, i, msg->payload); // z
memcpy(p->name, name, sizeof(p->name)); // char[10]:Name
p->usec = usec; // uint64_t:Timestamp
p->x = x; // float:x
p->y = y; // float:y
p->z = z; // float:z
return mavlink_finalize_message(msg, system_id, component_id, i);
return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_DEBUG_VECT_LEN);
}
/**
......@@ -57,16 +57,16 @@ static inline uint16_t mavlink_msg_debug_vect_pack(uint8_t system_id, uint8_t co
*/
static inline uint16_t mavlink_msg_debug_vect_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, const char* name, uint64_t usec, float x, float y, float z)
{
uint16_t i = 0;
mavlink_debug_vect_t *p = (mavlink_debug_vect_t *)&msg->payload[0];
msg->msgid = MAVLINK_MSG_ID_DEBUG_VECT;
i += put_array_by_index((const int8_t*)name, sizeof(char)*10, i, msg->payload); // Name
i += put_uint64_t_by_index(usec, i, msg->payload); // Timestamp
i += put_float_by_index(x, i, msg->payload); // x
i += put_float_by_index(y, i, msg->payload); // y
i += put_float_by_index(z, i, msg->payload); // z
memcpy(p->name, name, sizeof(p->name)); // char[10]:Name
p->usec = usec; // uint64_t:Timestamp
p->x = x; // float:x
p->y = y; // float:y
p->z = z; // float:z
return mavlink_finalize_message_chan(msg, system_id, component_id, chan, i);
return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_DEBUG_VECT_LEN);
}
/**
......@@ -93,12 +93,65 @@ static inline uint16_t mavlink_msg_debug_vect_encode(uint8_t system_id, uint8_t
* @param z z
*/
#ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS
static inline void mavlink_msg_debug_vect_send(mavlink_channel_t chan, const char* name, uint64_t usec, float x, float y, float z)
{
mavlink_message_t msg;
mavlink_msg_debug_vect_pack_chan(mavlink_system.sysid, mavlink_system.compid, chan, &msg, name, usec, x, y, z);
mavlink_send_uart(chan, &msg);
uint16_t checksum;
mavlink_debug_vect_t *p = (mavlink_debug_vect_t *)&msg.payload[0];
memcpy(p->name, name, sizeof(p->name)); // char[10]:Name
p->usec = usec; // uint64_t:Timestamp
p->x = x; // float:x
p->y = y; // float:y
p->z = z; // float:z
msg.STX = MAVLINK_STX;
msg.len = MAVLINK_MSG_ID_DEBUG_VECT_LEN;
msg.msgid = MAVLINK_MSG_ID_DEBUG_VECT;
msg.sysid = mavlink_system.sysid;
msg.compid = mavlink_system.compid;
msg.seq = mavlink_get_channel_status(chan)->current_tx_seq;
mavlink_get_channel_status(chan)->current_tx_seq = msg.seq + 1;
checksum = crc_calculate_msg(&msg, msg.len + MAVLINK_CORE_HEADER_LEN);
msg.ck_a = (uint8_t)(checksum & 0xFF); ///< Low byte
msg.ck_b = (uint8_t)(checksum >> 8); ///< High byte
mavlink_send_msg(chan, &msg);
}
#endif
#ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS_SMALL
static inline void mavlink_msg_debug_vect_send(mavlink_channel_t chan, const char* name, uint64_t usec, float x, float y, float z)
{
mavlink_header_t hdr;
mavlink_debug_vect_t payload;
uint16_t checksum;
mavlink_debug_vect_t *p = &payload;
memcpy(p->name, name, sizeof(p->name)); // char[10]:Name
p->usec = usec; // uint64_t:Timestamp
p->x = x; // float:x
p->y = y; // float:y
p->z = z; // float:z
hdr.STX = MAVLINK_STX;
hdr.len = MAVLINK_MSG_ID_DEBUG_VECT_LEN;
hdr.msgid = MAVLINK_MSG_ID_DEBUG_VECT;
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 );
crc_init(&checksum);
checksum = crc_calculate_mem((uint8_t *)&hdr.len, &checksum, MAVLINK_CORE_HEADER_LEN);
checksum = crc_calculate_mem((uint8_t *)&payload, &checksum, hdr.len );
hdr.ck_a = (uint8_t)(checksum & 0xFF); ///< Low byte
hdr.ck_b = (uint8_t)(checksum >> 8); ///< High byte
mavlink_send_mem(chan, (uint8_t *)&payload, hdr.len);
mavlink_send_mem(chan, (uint8_t *)&hdr.ck_a, MAVLINK_NUM_CHECKSUM_BYTES);
}
#endif
......@@ -109,11 +162,12 @@ static inline void mavlink_msg_debug_vect_send(mavlink_channel_t chan, const cha
*
* @return Name
*/
static inline uint16_t mavlink_msg_debug_vect_get_name(const mavlink_message_t* msg, char* r_data)
static inline uint16_t mavlink_msg_debug_vect_get_name(const mavlink_message_t* msg, char* name)
{
mavlink_debug_vect_t *p = (mavlink_debug_vect_t *)&msg->payload[0];
memcpy(r_data, msg->payload, sizeof(char)*10);
return sizeof(char)*10;
memcpy(name, p->name, sizeof(p->name));
return sizeof(p->name);
}
/**
......@@ -123,16 +177,8 @@ static inline uint16_t mavlink_msg_debug_vect_get_name(const mavlink_message_t*
*/
static inline uint64_t mavlink_msg_debug_vect_get_usec(const mavlink_message_t* msg)
{
generic_64bit r;
r.b[7] = (msg->payload+sizeof(char)*10)[0];
r.b[6] = (msg->payload+sizeof(char)*10)[1];
r.b[5] = (msg->payload+sizeof(char)*10)[2];
r.b[4] = (msg->payload+sizeof(char)*10)[3];
r.b[3] = (msg->payload+sizeof(char)*10)[4];
r.b[2] = (msg->payload+sizeof(char)*10)[5];
r.b[1] = (msg->payload+sizeof(char)*10)[6];
r.b[0] = (msg->payload+sizeof(char)*10)[7];
return (uint64_t)r.ll;
mavlink_debug_vect_t *p = (mavlink_debug_vect_t *)&msg->payload[0];
return (uint64_t)(p->usec);
}
/**
......@@ -142,12 +188,8 @@ static inline uint64_t mavlink_msg_debug_vect_get_usec(const mavlink_message_t*
*/
static inline float mavlink_msg_debug_vect_get_x(const mavlink_message_t* msg)
{
generic_32bit r;
r.b[3] = (msg->payload+sizeof(char)*10+sizeof(uint64_t))[0];
r.b[2] = (msg->payload+sizeof(char)*10+sizeof(uint64_t))[1];
r.b[1] = (msg->payload+sizeof(char)*10+sizeof(uint64_t))[2];
r.b[0] = (msg->payload+sizeof(char)*10+sizeof(uint64_t))[3];
return (float)r.f;
mavlink_debug_vect_t *p = (mavlink_debug_vect_t *)&msg->payload[0];
return (float)(p->x);
}
/**
......@@ -157,12 +199,8 @@ static inline float mavlink_msg_debug_vect_get_x(const mavlink_message_t* msg)
*/
static inline float mavlink_msg_debug_vect_get_y(const mavlink_message_t* msg)
{
generic_32bit r;
r.b[3] = (msg->payload+sizeof(char)*10+sizeof(uint64_t)+sizeof(float))[0];
r.b[2] = (msg->payload+sizeof(char)*10+sizeof(uint64_t)+sizeof(float))[1];
r.b[1] = (msg->payload+sizeof(char)*10+sizeof(uint64_t)+sizeof(float))[2];
r.b[0] = (msg->payload+sizeof(char)*10+sizeof(uint64_t)+sizeof(float))[3];
return (float)r.f;
mavlink_debug_vect_t *p = (mavlink_debug_vect_t *)&msg->payload[0];
return (float)(p->y);
}
/**
......@@ -172,12 +210,8 @@ static inline float mavlink_msg_debug_vect_get_y(const mavlink_message_t* msg)
*/
static inline float mavlink_msg_debug_vect_get_z(const mavlink_message_t* msg)
{
generic_32bit r;
r.b[3] = (msg->payload+sizeof(char)*10+sizeof(uint64_t)+sizeof(float)+sizeof(float))[0];
r.b[2] = (msg->payload+sizeof(char)*10+sizeof(uint64_t)+sizeof(float)+sizeof(float))[1];
r.b[1] = (msg->payload+sizeof(char)*10+sizeof(uint64_t)+sizeof(float)+sizeof(float))[2];
r.b[0] = (msg->payload+sizeof(char)*10+sizeof(uint64_t)+sizeof(float)+sizeof(float))[3];
return (float)r.f;
mavlink_debug_vect_t *p = (mavlink_debug_vect_t *)&msg->payload[0];
return (float)(p->z);
}
/**
......@@ -188,9 +222,5 @@ static inline float mavlink_msg_debug_vect_get_z(const mavlink_message_t* msg)
*/
static inline void mavlink_msg_debug_vect_decode(const mavlink_message_t* msg, mavlink_debug_vect_t* debug_vect)
{
mavlink_msg_debug_vect_get_name(msg, debug_vect->name);
debug_vect->usec = mavlink_msg_debug_vect_get_usec(msg);
debug_vect->x = mavlink_msg_debug_vect_get_x(msg);
debug_vect->y = mavlink_msg_debug_vect_get_y(msg);
debug_vect->z = mavlink_msg_debug_vect_get_z(msg);
memcpy( debug_vect, msg->payload, sizeof(mavlink_debug_vect_t));
}
// MESSAGE GPS_LOCAL_ORIGIN_SET PACKING
#define MAVLINK_MSG_ID_GPS_LOCAL_ORIGIN_SET 49
#define MAVLINK_MSG_ID_GPS_LOCAL_ORIGIN_SET_LEN 12
#define MAVLINK_MSG_49_LEN 12
typedef struct __mavlink_gps_local_origin_set_t
{
......@@ -10,8 +12,6 @@ typedef struct __mavlink_gps_local_origin_set_t
} mavlink_gps_local_origin_set_t;
/**
* @brief Pack a gps_local_origin_set message
* @param system_id ID of this system
......@@ -25,14 +25,14 @@ typedef struct __mavlink_gps_local_origin_set_t
*/
static inline uint16_t mavlink_msg_gps_local_origin_set_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, int32_t latitude, int32_t longitude, int32_t altitude)
{
uint16_t i = 0;
mavlink_gps_local_origin_set_t *p = (mavlink_gps_local_origin_set_t *)&msg->payload[0];
msg->msgid = MAVLINK_MSG_ID_GPS_LOCAL_ORIGIN_SET;
i += put_int32_t_by_index(latitude, i, msg->payload); // Latitude (WGS84), expressed as * 1E7
i += put_int32_t_by_index(longitude, i, msg->payload); // Longitude (WGS84), expressed as * 1E7
i += put_int32_t_by_index(altitude, i, msg->payload); // Altitude(WGS84), expressed as * 1000
p->latitude = latitude; // int32_t:Latitude (WGS84), expressed as * 1E7
p->longitude = longitude; // int32_t:Longitude (WGS84), expressed as * 1E7
p->altitude = altitude; // int32_t:Altitude(WGS84), expressed as * 1000
return mavlink_finalize_message(msg, system_id, component_id, i);
return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_GPS_LOCAL_ORIGIN_SET_LEN);
}
/**
......@@ -48,14 +48,14 @@ static inline uint16_t mavlink_msg_gps_local_origin_set_pack(uint8_t system_id,
*/
static inline uint16_t mavlink_msg_gps_local_origin_set_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, int32_t latitude, int32_t longitude, int32_t altitude)
{
uint16_t i = 0;
mavlink_gps_local_origin_set_t *p = (mavlink_gps_local_origin_set_t *)&msg->payload[0];
msg->msgid = MAVLINK_MSG_ID_GPS_LOCAL_ORIGIN_SET;
i += put_int32_t_by_index(latitude, i, msg->payload); // Latitude (WGS84), expressed as * 1E7
i += put_int32_t_by_index(longitude, i, msg->payload); // Longitude (WGS84), expressed as * 1E7
i += put_int32_t_by_index(altitude, i, msg->payload); // Altitude(WGS84), expressed as * 1000
p->latitude = latitude; // int32_t:Latitude (WGS84), expressed as * 1E7
p->longitude = longitude; // int32_t:Longitude (WGS84), expressed as * 1E7
p->altitude = altitude; // int32_t:Altitude(WGS84), expressed as * 1000
return mavlink_finalize_message_chan(msg, system_id, component_id, chan, i);
return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_GPS_LOCAL_ORIGIN_SET_LEN);
}
/**
......@@ -80,12 +80,61 @@ static inline uint16_t mavlink_msg_gps_local_origin_set_encode(uint8_t system_id
* @param altitude Altitude(WGS84), expressed as * 1000
*/
#ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS
static inline void mavlink_msg_gps_local_origin_set_send(mavlink_channel_t chan, int32_t latitude, int32_t longitude, int32_t altitude)
{
mavlink_message_t msg;
mavlink_msg_gps_local_origin_set_pack_chan(mavlink_system.sysid, mavlink_system.compid, chan, &msg, latitude, longitude, altitude);
mavlink_send_uart(chan, &msg);
uint16_t checksum;
mavlink_gps_local_origin_set_t *p = (mavlink_gps_local_origin_set_t *)&msg.payload[0];
p->latitude = latitude; // int32_t:Latitude (WGS84), expressed as * 1E7
p->longitude = longitude; // int32_t:Longitude (WGS84), expressed as * 1E7
p->altitude = altitude; // int32_t:Altitude(WGS84), expressed as * 1000
msg.STX = MAVLINK_STX;
msg.len = MAVLINK_MSG_ID_GPS_LOCAL_ORIGIN_SET_LEN;
msg.msgid = MAVLINK_MSG_ID_GPS_LOCAL_ORIGIN_SET;
msg.sysid = mavlink_system.sysid;
msg.compid = mavlink_system.compid;
msg.seq = mavlink_get_channel_status(chan)->current_tx_seq;
mavlink_get_channel_status(chan)->current_tx_seq = msg.seq + 1;
checksum = crc_calculate_msg(&msg, msg.len + MAVLINK_CORE_HEADER_LEN);
msg.ck_a = (uint8_t)(checksum & 0xFF); ///< Low byte
msg.ck_b = (uint8_t)(checksum >> 8); ///< High byte
mavlink_send_msg(chan, &msg);
}
#endif
#ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS_SMALL
static inline void mavlink_msg_gps_local_origin_set_send(mavlink_channel_t chan, int32_t latitude, int32_t longitude, int32_t altitude)
{
mavlink_header_t hdr;
mavlink_gps_local_origin_set_t payload;
uint16_t checksum;
mavlink_gps_local_origin_set_t *p = &payload;
p->latitude = latitude; // int32_t:Latitude (WGS84), expressed as * 1E7
p->longitude = longitude; // int32_t:Longitude (WGS84), expressed as * 1E7
p->altitude = altitude; // int32_t:Altitude(WGS84), expressed as * 1000
hdr.STX = MAVLINK_STX;
hdr.len = MAVLINK_MSG_ID_GPS_LOCAL_ORIGIN_SET_LEN;
hdr.msgid = MAVLINK_MSG_ID_GPS_LOCAL_ORIGIN_SET;
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 );
crc_init(&checksum);
checksum = crc_calculate_mem((uint8_t *)&hdr.len, &checksum, MAVLINK_CORE_HEADER_LEN);
checksum = crc_calculate_mem((uint8_t *)&payload, &checksum, hdr.len );
hdr.ck_a = (uint8_t)(checksum & 0xFF); ///< Low byte
hdr.ck_b = (uint8_t)(checksum >> 8); ///< High byte
mavlink_send_mem(chan, (uint8_t *)&payload, hdr.len);
mavlink_send_mem(chan, (uint8_t *)&hdr.ck_a, MAVLINK_NUM_CHECKSUM_BYTES);
}
#endif
......@@ -98,12 +147,8 @@ static inline void mavlink_msg_gps_local_origin_set_send(mavlink_channel_t chan,
*/
static inline int32_t mavlink_msg_gps_local_origin_set_get_latitude(const mavlink_message_t* msg)
{
generic_32bit r;
r.b[3] = (msg->payload)[0];
r.b[2] = (msg->payload)[1];
r.b[1] = (msg->payload)[2];
r.b[0] = (msg->payload)[3];
return (int32_t)r.i;
mavlink_gps_local_origin_set_t *p = (mavlink_gps_local_origin_set_t *)&msg->payload[0];
return (int32_t)(p->latitude);
}
/**
......@@ -113,12 +158,8 @@ static inline int32_t mavlink_msg_gps_local_origin_set_get_latitude(const mavlin
*/
static inline int32_t mavlink_msg_gps_local_origin_set_get_longitude(const mavlink_message_t* msg)
{
generic_32bit r;
r.b[3] = (msg->payload+sizeof(int32_t))[0];
r.b[2] = (msg->payload+sizeof(int32_t))[1];
r.b[1] = (msg->payload+sizeof(int32_t))[2];
r.b[0] = (msg->payload+sizeof(int32_t))[3];
return (int32_t)r.i;
mavlink_gps_local_origin_set_t *p = (mavlink_gps_local_origin_set_t *)&msg->payload[0];
return (int32_t)(p->longitude);
}
/**
......@@ -128,12 +169,8 @@ static inline int32_t mavlink_msg_gps_local_origin_set_get_longitude(const mavli
*/
static inline int32_t mavlink_msg_gps_local_origin_set_get_altitude(const mavlink_message_t* msg)
{
generic_32bit r;
r.b[3] = (msg->payload+sizeof(int32_t)+sizeof(int32_t))[0];
r.b[2] = (msg->payload+sizeof(int32_t)+sizeof(int32_t))[1];
r.b[1] = (msg->payload+sizeof(int32_t)+sizeof(int32_t))[2];
r.b[0] = (msg->payload+sizeof(int32_t)+sizeof(int32_t))[3];
return (int32_t)r.i;
mavlink_gps_local_origin_set_t *p = (mavlink_gps_local_origin_set_t *)&msg->payload[0];
return (int32_t)(p->altitude);
}
/**
......@@ -144,7 +181,5 @@ static inline int32_t mavlink_msg_gps_local_origin_set_get_altitude(const mavlin
*/
static inline void mavlink_msg_gps_local_origin_set_decode(const mavlink_message_t* msg, mavlink_gps_local_origin_set_t* gps_local_origin_set)
{
gps_local_origin_set->latitude = mavlink_msg_gps_local_origin_set_get_latitude(msg);
gps_local_origin_set->longitude = mavlink_msg_gps_local_origin_set_get_longitude(msg);
gps_local_origin_set->altitude = mavlink_msg_gps_local_origin_set_get_altitude(msg);
memcpy( gps_local_origin_set, msg->payload, sizeof(mavlink_gps_local_origin_set_t));
}
// MESSAGE GPS_SET_GLOBAL_ORIGIN PACKING
#define MAVLINK_MSG_ID_GPS_SET_GLOBAL_ORIGIN 48
#define MAVLINK_MSG_ID_GPS_SET_GLOBAL_ORIGIN_LEN 14
#define MAVLINK_MSG_48_LEN 14
typedef struct __mavlink_gps_set_global_origin_t
{
......@@ -12,8 +14,6 @@ typedef struct __mavlink_gps_set_global_origin_t
} mavlink_gps_set_global_origin_t;
/**
* @brief Pack a gps_set_global_origin message
* @param system_id ID of this system
......@@ -29,16 +29,16 @@ typedef struct __mavlink_gps_set_global_origin_t
*/
static inline uint16_t mavlink_msg_gps_set_global_origin_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, uint8_t target_system, uint8_t target_component, int32_t latitude, int32_t longitude, int32_t altitude)
{
uint16_t i = 0;
mavlink_gps_set_global_origin_t *p = (mavlink_gps_set_global_origin_t *)&msg->payload[0];
msg->msgid = MAVLINK_MSG_ID_GPS_SET_GLOBAL_ORIGIN;
i += put_uint8_t_by_index(target_system, i, msg->payload); // System ID
i += put_uint8_t_by_index(target_component, i, msg->payload); // Component ID
i += put_int32_t_by_index(latitude, i, msg->payload); // global position * 1E7
i += put_int32_t_by_index(longitude, i, msg->payload); // global position * 1E7
i += put_int32_t_by_index(altitude, i, msg->payload); // global position * 1000
p->target_system = target_system; // uint8_t:System ID
p->target_component = target_component; // uint8_t:Component ID
p->latitude = latitude; // int32_t:global position * 1E7
p->longitude = longitude; // int32_t:global position * 1E7
p->altitude = altitude; // int32_t:global position * 1000
return mavlink_finalize_message(msg, system_id, component_id, i);
return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_GPS_SET_GLOBAL_ORIGIN_LEN);
}
/**
......@@ -56,16 +56,16 @@ static inline uint16_t mavlink_msg_gps_set_global_origin_pack(uint8_t system_id,
*/
static inline uint16_t mavlink_msg_gps_set_global_origin_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, uint8_t target_system, uint8_t target_component, int32_t latitude, int32_t longitude, int32_t altitude)
{
uint16_t i = 0;
mavlink_gps_set_global_origin_t *p = (mavlink_gps_set_global_origin_t *)&msg->payload[0];
msg->msgid = MAVLINK_MSG_ID_GPS_SET_GLOBAL_ORIGIN;
i += put_uint8_t_by_index(target_system, i, msg->payload); // System ID
i += put_uint8_t_by_index(target_component, i, msg->payload); // Component ID
i += put_int32_t_by_index(latitude, i, msg->payload); // global position * 1E7
i += put_int32_t_by_index(longitude, i, msg->payload); // global position * 1E7
i += put_int32_t_by_index(altitude, i, msg->payload); // global position * 1000
p->target_system = target_system; // uint8_t:System ID
p->target_component = target_component; // uint8_t:Component ID
p->latitude = latitude; // int32_t:global position * 1E7
p->longitude = longitude; // int32_t:global position * 1E7
p->altitude = altitude; // int32_t:global position * 1000
return mavlink_finalize_message_chan(msg, system_id, component_id, chan, i);
return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_GPS_SET_GLOBAL_ORIGIN_LEN);
}
/**
......@@ -92,12 +92,65 @@ static inline uint16_t mavlink_msg_gps_set_global_origin_encode(uint8_t system_i
* @param altitude global position * 1000
*/
#ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS
static inline void mavlink_msg_gps_set_global_origin_send(mavlink_channel_t chan, uint8_t target_system, uint8_t target_component, int32_t latitude, int32_t longitude, int32_t altitude)
{
mavlink_message_t msg;
mavlink_msg_gps_set_global_origin_pack_chan(mavlink_system.sysid, mavlink_system.compid, chan, &msg, target_system, target_component, latitude, longitude, altitude);
mavlink_send_uart(chan, &msg);
uint16_t checksum;
mavlink_gps_set_global_origin_t *p = (mavlink_gps_set_global_origin_t *)&msg.payload[0];
p->target_system = target_system; // uint8_t:System ID
p->target_component = target_component; // uint8_t:Component ID
p->latitude = latitude; // int32_t:global position * 1E7
p->longitude = longitude; // int32_t:global position * 1E7
p->altitude = altitude; // int32_t:global position * 1000
msg.STX = MAVLINK_STX;
msg.len = MAVLINK_MSG_ID_GPS_SET_GLOBAL_ORIGIN_LEN;
msg.msgid = MAVLINK_MSG_ID_GPS_SET_GLOBAL_ORIGIN;
msg.sysid = mavlink_system.sysid;
msg.compid = mavlink_system.compid;
msg.seq = mavlink_get_channel_status(chan)->current_tx_seq;
mavlink_get_channel_status(chan)->current_tx_seq = msg.seq + 1;
checksum = crc_calculate_msg(&msg, msg.len + MAVLINK_CORE_HEADER_LEN);
msg.ck_a = (uint8_t)(checksum & 0xFF); ///< Low byte
msg.ck_b = (uint8_t)(checksum >> 8); ///< High byte
mavlink_send_msg(chan, &msg);
}
#endif
#ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS_SMALL
static inline void mavlink_msg_gps_set_global_origin_send(mavlink_channel_t chan, uint8_t target_system, uint8_t target_component, int32_t latitude, int32_t longitude, int32_t altitude)
{
mavlink_header_t hdr;
mavlink_gps_set_global_origin_t payload;
uint16_t checksum;
mavlink_gps_set_global_origin_t *p = &payload;
p->target_system = target_system; // uint8_t:System ID
p->target_component = target_component; // uint8_t:Component ID
p->latitude = latitude; // int32_t:global position * 1E7
p->longitude = longitude; // int32_t:global position * 1E7
p->altitude = altitude; // int32_t:global position * 1000
hdr.STX = MAVLINK_STX;
hdr.len = MAVLINK_MSG_ID_GPS_SET_GLOBAL_ORIGIN_LEN;
hdr.msgid = MAVLINK_MSG_ID_GPS_SET_GLOBAL_ORIGIN;
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 );
crc_init(&checksum);
checksum = crc_calculate_mem((uint8_t *)&hdr.len, &checksum, MAVLINK_CORE_HEADER_LEN);
checksum = crc_calculate_mem((uint8_t *)&payload, &checksum, hdr.len );
hdr.ck_a = (uint8_t)(checksum & 0xFF); ///< Low byte
hdr.ck_b = (uint8_t)(checksum >> 8); ///< High byte
mavlink_send_mem(chan, (uint8_t *)&payload, hdr.len);
mavlink_send_mem(chan, (uint8_t *)&hdr.ck_a, MAVLINK_NUM_CHECKSUM_BYTES);
}
#endif
......@@ -110,7 +163,8 @@ static inline void mavlink_msg_gps_set_global_origin_send(mavlink_channel_t chan
*/
static inline uint8_t mavlink_msg_gps_set_global_origin_get_target_system(const mavlink_message_t* msg)
{
return (uint8_t)(msg->payload)[0];
mavlink_gps_set_global_origin_t *p = (mavlink_gps_set_global_origin_t *)&msg->payload[0];
return (uint8_t)(p->target_system);
}
/**
......@@ -120,7 +174,8 @@ static inline uint8_t mavlink_msg_gps_set_global_origin_get_target_system(const
*/
static inline uint8_t mavlink_msg_gps_set_global_origin_get_target_component(const mavlink_message_t* msg)
{
return (uint8_t)(msg->payload+sizeof(uint8_t))[0];
mavlink_gps_set_global_origin_t *p = (mavlink_gps_set_global_origin_t *)&msg->payload[0];
return (uint8_t)(p->target_component);
}
/**
......@@ -130,12 +185,8 @@ static inline uint8_t mavlink_msg_gps_set_global_origin_get_target_component(con
*/
static inline int32_t mavlink_msg_gps_set_global_origin_get_latitude(const mavlink_message_t* msg)
{
generic_32bit r;
r.b[3] = (msg->payload+sizeof(uint8_t)+sizeof(uint8_t))[0];
r.b[2] = (msg->payload+sizeof(uint8_t)+sizeof(uint8_t))[1];
r.b[1] = (msg->payload+sizeof(uint8_t)+sizeof(uint8_t))[2];
r.b[0] = (msg->payload+sizeof(uint8_t)+sizeof(uint8_t))[3];
return (int32_t)r.i;
mavlink_gps_set_global_origin_t *p = (mavlink_gps_set_global_origin_t *)&msg->payload[0];
return (int32_t)(p->latitude);
}
/**
......@@ -145,12 +196,8 @@ static inline int32_t mavlink_msg_gps_set_global_origin_get_latitude(const mavli
*/
static inline int32_t mavlink_msg_gps_set_global_origin_get_longitude(const mavlink_message_t* msg)
{
generic_32bit r;
r.b[3] = (msg->payload+sizeof(uint8_t)+sizeof(uint8_t)+sizeof(int32_t))[0];
r.b[2] = (msg->payload+sizeof(uint8_t)+sizeof(uint8_t)+sizeof(int32_t))[1];
r.b[1] = (msg->payload+sizeof(uint8_t)+sizeof(uint8_t)+sizeof(int32_t))[2];
r.b[0] = (msg->payload+sizeof(uint8_t)+sizeof(uint8_t)+sizeof(int32_t))[3];
return (int32_t)r.i;
mavlink_gps_set_global_origin_t *p = (mavlink_gps_set_global_origin_t *)&msg->payload[0];
return (int32_t)(p->longitude);
}
/**
......@@ -160,12 +207,8 @@ static inline int32_t mavlink_msg_gps_set_global_origin_get_longitude(const mavl
*/
static inline int32_t mavlink_msg_gps_set_global_origin_get_altitude(const mavlink_message_t* msg)
{
generic_32bit r;
r.b[3] = (msg->payload+sizeof(uint8_t)+sizeof(uint8_t)+sizeof(int32_t)+sizeof(int32_t))[0];
r.b[2] = (msg->payload+sizeof(uint8_t)+sizeof(uint8_t)+sizeof(int32_t)+sizeof(int32_t))[1];
r.b[1] = (msg->payload+sizeof(uint8_t)+sizeof(uint8_t)+sizeof(int32_t)+sizeof(int32_t))[2];
r.b[0] = (msg->payload+sizeof(uint8_t)+sizeof(uint8_t)+sizeof(int32_t)+sizeof(int32_t))[3];
return (int32_t)r.i;
mavlink_gps_set_global_origin_t *p = (mavlink_gps_set_global_origin_t *)&msg->payload[0];
return (int32_t)(p->altitude);
}
/**
......@@ -176,9 +219,5 @@ static inline int32_t mavlink_msg_gps_set_global_origin_get_altitude(const mavli
*/
static inline void mavlink_msg_gps_set_global_origin_decode(const mavlink_message_t* msg, mavlink_gps_set_global_origin_t* gps_set_global_origin)
{
gps_set_global_origin->target_system = mavlink_msg_gps_set_global_origin_get_target_system(msg);
gps_set_global_origin->target_component = mavlink_msg_gps_set_global_origin_get_target_component(msg);
gps_set_global_origin->latitude = mavlink_msg_gps_set_global_origin_get_latitude(msg);
gps_set_global_origin->longitude = mavlink_msg_gps_set_global_origin_get_longitude(msg);
gps_set_global_origin->altitude = mavlink_msg_gps_set_global_origin_get_altitude(msg);
memcpy( gps_set_global_origin, msg->payload, sizeof(mavlink_gps_set_global_origin_t));
}
// MESSAGE HEARTBEAT PACKING
#define MAVLINK_MSG_ID_HEARTBEAT 0
#define MAVLINK_MSG_ID_HEARTBEAT_LEN 3
#define MAVLINK_MSG_0_LEN 3
typedef struct __mavlink_heartbeat_t
{
......@@ -10,8 +12,6 @@ typedef struct __mavlink_heartbeat_t
} mavlink_heartbeat_t;
/**
* @brief Pack a heartbeat message
* @param system_id ID of this system
......@@ -24,14 +24,14 @@ typedef struct __mavlink_heartbeat_t
*/
static inline uint16_t mavlink_msg_heartbeat_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, uint8_t type, uint8_t autopilot)
{
uint16_t i = 0;
mavlink_heartbeat_t *p = (mavlink_heartbeat_t *)&msg->payload[0];
msg->msgid = MAVLINK_MSG_ID_HEARTBEAT;
i += put_uint8_t_by_index(type, i, msg->payload); // Type of the MAV (quadrotor, helicopter, etc., up to 15 types, defined in MAV_TYPE ENUM)
i += put_uint8_t_by_index(autopilot, i, msg->payload); // Type of the Autopilot: 0: Generic, 1: PIXHAWK, 2: SLUGS, 3: Ardupilot (up to 15 types), defined in MAV_AUTOPILOT_TYPE ENUM
i += put_uint8_t_by_index(2, i, msg->payload); // MAVLink version
p->type = type; // uint8_t:Type of the MAV (quadrotor, helicopter, etc., up to 15 types, defined in MAV_TYPE ENUM)
p->autopilot = autopilot; // uint8_t:Type of the Autopilot: 0: Generic, 1: PIXHAWK, 2: SLUGS, 3: Ardupilot (up to 15 types), defined in MAV_AUTOPILOT_TYPE ENUM
return mavlink_finalize_message(msg, system_id, component_id, i);
p->mavlink_version = MAVLINK_VERSION; // uint8_t_mavlink_version:MAVLink version
return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_HEARTBEAT_LEN);
}
/**
......@@ -46,14 +46,14 @@ static inline uint16_t mavlink_msg_heartbeat_pack(uint8_t system_id, uint8_t com
*/
static inline uint16_t mavlink_msg_heartbeat_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, uint8_t type, uint8_t autopilot)
{
uint16_t i = 0;
mavlink_heartbeat_t *p = (mavlink_heartbeat_t *)&msg->payload[0];
msg->msgid = MAVLINK_MSG_ID_HEARTBEAT;
i += put_uint8_t_by_index(type, i, msg->payload); // Type of the MAV (quadrotor, helicopter, etc., up to 15 types, defined in MAV_TYPE ENUM)
i += put_uint8_t_by_index(autopilot, i, msg->payload); // Type of the Autopilot: 0: Generic, 1: PIXHAWK, 2: SLUGS, 3: Ardupilot (up to 15 types), defined in MAV_AUTOPILOT_TYPE ENUM
i += put_uint8_t_by_index(2, i, msg->payload); // MAVLink version
p->type = type; // uint8_t:Type of the MAV (quadrotor, helicopter, etc., up to 15 types, defined in MAV_TYPE ENUM)
p->autopilot = autopilot; // uint8_t:Type of the Autopilot: 0: Generic, 1: PIXHAWK, 2: SLUGS, 3: Ardupilot (up to 15 types), defined in MAV_AUTOPILOT_TYPE ENUM
return mavlink_finalize_message_chan(msg, system_id, component_id, chan, i);
p->mavlink_version = MAVLINK_VERSION; // uint8_t_mavlink_version:MAVLink version
return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_HEARTBEAT_LEN);
}
/**
......@@ -77,12 +77,61 @@ static inline uint16_t mavlink_msg_heartbeat_encode(uint8_t system_id, uint8_t c
* @param autopilot Type of the Autopilot: 0: Generic, 1: PIXHAWK, 2: SLUGS, 3: Ardupilot (up to 15 types), defined in MAV_AUTOPILOT_TYPE ENUM
*/
#ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS
static inline void mavlink_msg_heartbeat_send(mavlink_channel_t chan, uint8_t type, uint8_t autopilot)
{
mavlink_message_t msg;
mavlink_msg_heartbeat_pack_chan(mavlink_system.sysid, mavlink_system.compid, chan, &msg, type, autopilot);
mavlink_send_uart(chan, &msg);
uint16_t checksum;
mavlink_heartbeat_t *p = (mavlink_heartbeat_t *)&msg.payload[0];
p->type = type; // uint8_t:Type of the MAV (quadrotor, helicopter, etc., up to 15 types, defined in MAV_TYPE ENUM)
p->autopilot = autopilot; // uint8_t:Type of the Autopilot: 0: Generic, 1: PIXHAWK, 2: SLUGS, 3: Ardupilot (up to 15 types), defined in MAV_AUTOPILOT_TYPE ENUM
p->mavlink_version = MAVLINK_VERSION; // uint8_t_mavlink_version:MAVLink version
msg.STX = MAVLINK_STX;
msg.len = MAVLINK_MSG_ID_HEARTBEAT_LEN;
msg.msgid = MAVLINK_MSG_ID_HEARTBEAT;
msg.sysid = mavlink_system.sysid;
msg.compid = mavlink_system.compid;
msg.seq = mavlink_get_channel_status(chan)->current_tx_seq;
mavlink_get_channel_status(chan)->current_tx_seq = msg.seq + 1;
checksum = crc_calculate_msg(&msg, msg.len + MAVLINK_CORE_HEADER_LEN);
msg.ck_a = (uint8_t)(checksum & 0xFF); ///< Low byte
msg.ck_b = (uint8_t)(checksum >> 8); ///< High byte
mavlink_send_msg(chan, &msg);
}
#endif
#ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS_SMALL
static inline void mavlink_msg_heartbeat_send(mavlink_channel_t chan, uint8_t type, uint8_t autopilot)
{
mavlink_header_t hdr;
mavlink_heartbeat_t payload;
uint16_t checksum;
mavlink_heartbeat_t *p = &payload;
p->type = type; // uint8_t:Type of the MAV (quadrotor, helicopter, etc., up to 15 types, defined in MAV_TYPE ENUM)
p->autopilot = autopilot; // uint8_t:Type of the Autopilot: 0: Generic, 1: PIXHAWK, 2: SLUGS, 3: Ardupilot (up to 15 types), defined in MAV_AUTOPILOT_TYPE ENUM
p->mavlink_version = MAVLINK_VERSION; // uint8_t_mavlink_version:MAVLink version
hdr.STX = MAVLINK_STX;
hdr.len = MAVLINK_MSG_ID_HEARTBEAT_LEN;
hdr.msgid = MAVLINK_MSG_ID_HEARTBEAT;
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 );
crc_init(&checksum);
checksum = crc_calculate_mem((uint8_t *)&hdr.len, &checksum, MAVLINK_CORE_HEADER_LEN);
checksum = crc_calculate_mem((uint8_t *)&payload, &checksum, hdr.len );
hdr.ck_a = (uint8_t)(checksum & 0xFF); ///< Low byte
hdr.ck_b = (uint8_t)(checksum >> 8); ///< High byte
mavlink_send_mem(chan, (uint8_t *)&payload, hdr.len);
mavlink_send_mem(chan, (uint8_t *)&hdr.ck_a, MAVLINK_NUM_CHECKSUM_BYTES);
}
#endif
......@@ -95,7 +144,8 @@ static inline void mavlink_msg_heartbeat_send(mavlink_channel_t chan, uint8_t ty
*/
static inline uint8_t mavlink_msg_heartbeat_get_type(const mavlink_message_t* msg)
{
return (uint8_t)(msg->payload)[0];
mavlink_heartbeat_t *p = (mavlink_heartbeat_t *)&msg->payload[0];
return (uint8_t)(p->type);
}
/**
......@@ -105,7 +155,8 @@ static inline uint8_t mavlink_msg_heartbeat_get_type(const mavlink_message_t* ms
*/
static inline uint8_t mavlink_msg_heartbeat_get_autopilot(const mavlink_message_t* msg)
{
return (uint8_t)(msg->payload+sizeof(uint8_t))[0];
mavlink_heartbeat_t *p = (mavlink_heartbeat_t *)&msg->payload[0];
return (uint8_t)(p->autopilot);
}
/**
......@@ -115,7 +166,8 @@ static inline uint8_t mavlink_msg_heartbeat_get_autopilot(const mavlink_message_
*/
static inline uint8_t mavlink_msg_heartbeat_get_mavlink_version(const mavlink_message_t* msg)
{
return (uint8_t)(msg->payload+sizeof(uint8_t)+sizeof(uint8_t))[0];
mavlink_heartbeat_t *p = (mavlink_heartbeat_t *)&msg->payload[0];
return (uint8_t)(p->mavlink_version);
}
/**
......@@ -126,7 +178,5 @@ static inline uint8_t mavlink_msg_heartbeat_get_mavlink_version(const mavlink_me
*/
static inline void mavlink_msg_heartbeat_decode(const mavlink_message_t* msg, mavlink_heartbeat_t* heartbeat)
{
heartbeat->type = mavlink_msg_heartbeat_get_type(msg);
heartbeat->autopilot = mavlink_msg_heartbeat_get_autopilot(msg);
heartbeat->mavlink_version = mavlink_msg_heartbeat_get_mavlink_version(msg);
memcpy( heartbeat, msg->payload, sizeof(mavlink_heartbeat_t));
}
// MESSAGE LOCAL_POSITION_SETPOINT PACKING
#define MAVLINK_MSG_ID_LOCAL_POSITION_SETPOINT 51
#define MAVLINK_MSG_ID_LOCAL_POSITION_SETPOINT_LEN 16
#define MAVLINK_MSG_51_LEN 16
typedef struct __mavlink_local_position_setpoint_t
{
......@@ -11,8 +13,6 @@ typedef struct __mavlink_local_position_setpoint_t
} mavlink_local_position_setpoint_t;
/**
* @brief Pack a local_position_setpoint message
* @param system_id ID of this system
......@@ -27,15 +27,15 @@ typedef struct __mavlink_local_position_setpoint_t
*/
static inline uint16_t mavlink_msg_local_position_setpoint_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, float x, float y, float z, float yaw)
{
uint16_t i = 0;
mavlink_local_position_setpoint_t *p = (mavlink_local_position_setpoint_t *)&msg->payload[0];
msg->msgid = MAVLINK_MSG_ID_LOCAL_POSITION_SETPOINT;
i += put_float_by_index(x, i, msg->payload); // x position
i += put_float_by_index(y, i, msg->payload); // y position
i += put_float_by_index(z, i, msg->payload); // z position
i += put_float_by_index(yaw, i, msg->payload); // Desired yaw angle
p->x = x; // float:x position
p->y = y; // float:y position
p->z = z; // float:z position
p->yaw = yaw; // float:Desired yaw angle
return mavlink_finalize_message(msg, system_id, component_id, i);
return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_LOCAL_POSITION_SETPOINT_LEN);
}
/**
......@@ -52,15 +52,15 @@ static inline uint16_t mavlink_msg_local_position_setpoint_pack(uint8_t system_i
*/
static inline uint16_t mavlink_msg_local_position_setpoint_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, float x, float y, float z, float yaw)
{
uint16_t i = 0;
mavlink_local_position_setpoint_t *p = (mavlink_local_position_setpoint_t *)&msg->payload[0];
msg->msgid = MAVLINK_MSG_ID_LOCAL_POSITION_SETPOINT;
i += put_float_by_index(x, i, msg->payload); // x position
i += put_float_by_index(y, i, msg->payload); // y position
i += put_float_by_index(z, i, msg->payload); // z position
i += put_float_by_index(yaw, i, msg->payload); // Desired yaw angle
p->x = x; // float:x position
p->y = y; // float:y position
p->z = z; // float:z position
p->yaw = yaw; // float:Desired yaw angle
return mavlink_finalize_message_chan(msg, system_id, component_id, chan, i);
return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_LOCAL_POSITION_SETPOINT_LEN);
}
/**
......@@ -86,12 +86,63 @@ static inline uint16_t mavlink_msg_local_position_setpoint_encode(uint8_t system
* @param yaw Desired yaw angle
*/
#ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS
static inline void mavlink_msg_local_position_setpoint_send(mavlink_channel_t chan, float x, float y, float z, float yaw)
{
mavlink_message_t msg;
mavlink_msg_local_position_setpoint_pack_chan(mavlink_system.sysid, mavlink_system.compid, chan, &msg, x, y, z, yaw);
mavlink_send_uart(chan, &msg);
uint16_t checksum;
mavlink_local_position_setpoint_t *p = (mavlink_local_position_setpoint_t *)&msg.payload[0];
p->x = x; // float:x position
p->y = y; // float:y position
p->z = z; // float:z position
p->yaw = yaw; // float:Desired yaw angle
msg.STX = MAVLINK_STX;
msg.len = MAVLINK_MSG_ID_LOCAL_POSITION_SETPOINT_LEN;
msg.msgid = MAVLINK_MSG_ID_LOCAL_POSITION_SETPOINT;
msg.sysid = mavlink_system.sysid;
msg.compid = mavlink_system.compid;
msg.seq = mavlink_get_channel_status(chan)->current_tx_seq;
mavlink_get_channel_status(chan)->current_tx_seq = msg.seq + 1;
checksum = crc_calculate_msg(&msg, msg.len + MAVLINK_CORE_HEADER_LEN);
msg.ck_a = (uint8_t)(checksum & 0xFF); ///< Low byte
msg.ck_b = (uint8_t)(checksum >> 8); ///< High byte
mavlink_send_msg(chan, &msg);
}
#endif
#ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS_SMALL
static inline void mavlink_msg_local_position_setpoint_send(mavlink_channel_t chan, float x, float y, float z, float yaw)
{
mavlink_header_t hdr;
mavlink_local_position_setpoint_t payload;
uint16_t checksum;
mavlink_local_position_setpoint_t *p = &payload;
p->x = x; // float:x position
p->y = y; // float:y position
p->z = z; // float:z position
p->yaw = yaw; // float:Desired yaw angle
hdr.STX = MAVLINK_STX;
hdr.len = MAVLINK_MSG_ID_LOCAL_POSITION_SETPOINT_LEN;
hdr.msgid = MAVLINK_MSG_ID_LOCAL_POSITION_SETPOINT;
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 );
crc_init(&checksum);
checksum = crc_calculate_mem((uint8_t *)&hdr.len, &checksum, MAVLINK_CORE_HEADER_LEN);
checksum = crc_calculate_mem((uint8_t *)&payload, &checksum, hdr.len );
hdr.ck_a = (uint8_t)(checksum & 0xFF); ///< Low byte
hdr.ck_b = (uint8_t)(checksum >> 8); ///< High byte
mavlink_send_mem(chan, (uint8_t *)&payload, hdr.len);
mavlink_send_mem(chan, (uint8_t *)&hdr.ck_a, MAVLINK_NUM_CHECKSUM_BYTES);
}
#endif
......@@ -104,12 +155,8 @@ static inline void mavlink_msg_local_position_setpoint_send(mavlink_channel_t ch
*/
static inline float mavlink_msg_local_position_setpoint_get_x(const mavlink_message_t* msg)
{
generic_32bit r;
r.b[3] = (msg->payload)[0];
r.b[2] = (msg->payload)[1];
r.b[1] = (msg->payload)[2];
r.b[0] = (msg->payload)[3];
return (float)r.f;
mavlink_local_position_setpoint_t *p = (mavlink_local_position_setpoint_t *)&msg->payload[0];
return (float)(p->x);
}
/**
......@@ -119,12 +166,8 @@ static inline float mavlink_msg_local_position_setpoint_get_x(const mavlink_mess
*/
static inline float mavlink_msg_local_position_setpoint_get_y(const mavlink_message_t* msg)
{
generic_32bit r;
r.b[3] = (msg->payload+sizeof(float))[0];
r.b[2] = (msg->payload+sizeof(float))[1];
r.b[1] = (msg->payload+sizeof(float))[2];
r.b[0] = (msg->payload+sizeof(float))[3];
return (float)r.f;
mavlink_local_position_setpoint_t *p = (mavlink_local_position_setpoint_t *)&msg->payload[0];
return (float)(p->y);
}
/**
......@@ -134,12 +177,8 @@ static inline float mavlink_msg_local_position_setpoint_get_y(const mavlink_mess
*/
static inline float mavlink_msg_local_position_setpoint_get_z(const mavlink_message_t* msg)
{
generic_32bit r;
r.b[3] = (msg->payload+sizeof(float)+sizeof(float))[0];
r.b[2] = (msg->payload+sizeof(float)+sizeof(float))[1];
r.b[1] = (msg->payload+sizeof(float)+sizeof(float))[2];
r.b[0] = (msg->payload+sizeof(float)+sizeof(float))[3];
return (float)r.f;
mavlink_local_position_setpoint_t *p = (mavlink_local_position_setpoint_t *)&msg->payload[0];
return (float)(p->z);
}
/**
......@@ -149,12 +188,8 @@ static inline float mavlink_msg_local_position_setpoint_get_z(const mavlink_mess
*/
static inline float mavlink_msg_local_position_setpoint_get_yaw(const mavlink_message_t* msg)
{
generic_32bit r;
r.b[3] = (msg->payload+sizeof(float)+sizeof(float)+sizeof(float))[0];
r.b[2] = (msg->payload+sizeof(float)+sizeof(float)+sizeof(float))[1];
r.b[1] = (msg->payload+sizeof(float)+sizeof(float)+sizeof(float))[2];
r.b[0] = (msg->payload+sizeof(float)+sizeof(float)+sizeof(float))[3];
return (float)r.f;
mavlink_local_position_setpoint_t *p = (mavlink_local_position_setpoint_t *)&msg->payload[0];
return (float)(p->yaw);
}
/**
......@@ -165,8 +200,5 @@ static inline float mavlink_msg_local_position_setpoint_get_yaw(const mavlink_me
*/
static inline void mavlink_msg_local_position_setpoint_decode(const mavlink_message_t* msg, mavlink_local_position_setpoint_t* local_position_setpoint)
{
local_position_setpoint->x = mavlink_msg_local_position_setpoint_get_x(msg);
local_position_setpoint->y = mavlink_msg_local_position_setpoint_get_y(msg);
local_position_setpoint->z = mavlink_msg_local_position_setpoint_get_z(msg);
local_position_setpoint->yaw = mavlink_msg_local_position_setpoint_get_yaw(msg);
memcpy( local_position_setpoint, msg->payload, sizeof(mavlink_local_position_setpoint_t));
}
This diff is collapsed.
/** @file
* @brief MAVLink comm protocol.
* @see http://pixhawk.ethz.ch/software/mavlink
* Generated on Wednesday, July 27 2011, 14:17 UTC
* Generated on Sunday, July 31 2011, 15:11 UTC
*/
#ifndef MAVLINK_H
#define MAVLINK_H
#pragma pack(push,1)
#include "minimal.h"
#ifdef MAVLINK_CHECK_LENGTH
#include "lengths.h"
#endif
#pragma pack(pop)
#endif
/** @file
* @brief MAVLink comm protocol.
* @see http://qgroundcontrol.org/mavlink/
* Generated on Wednesday, July 27 2011, 14:17 UTC
* Generated on Sunday, July 31 2011, 15:11 UTC
*/
#ifndef MINIMAL_H
#define MINIMAL_H
......@@ -32,13 +32,6 @@ extern "C" {
// MESSAGE DEFINITIONS
#include "./mavlink_msg_heartbeat.h"
// MESSAGE LENGTHS
#undef MAVLINK_MESSAGE_LENGTHS
#define MAVLINK_MESSAGE_LENGTHS { }
#ifdef __cplusplus
}
#endif
......
/** @file
* @brief MAVLink comm protocol.
* @see http://pixhawk.ethz.ch/software/mavlink
* Generated on Wednesday, July 27 2011, 14:17 UTC
* Generated on Sunday, July 31 2011, 15:11 UTC
*/
#ifndef MAVLINK_H
#define MAVLINK_H
#pragma pack(push,1)
#include "pixhawk.h"
#ifdef MAVLINK_CHECK_LENGTH
#include "lengths.h"
#endif
#pragma pack(pop)
#endif
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment