Commit fe178f2a authored by James Goppert's avatar James Goppert

Updated mavlink.

parent 10f544c1
......@@ -115,7 +115,7 @@ else()
endif()
find_or_build_from_source(MAVLINK thirdParty/mavlink)
find_or_build_from_source(QSERIAL thirdParty/qserial)
find_or_build_from_source(QSERIALPORT thirdParty/qserialport)
# build libraries from source if not found on system
if(MAVLINK_BUILD_FROM_SOURCE)
......@@ -132,67 +132,67 @@ if(MAVLINK_BUILD_FROM_SOURCE)
COMMAND touch MAVLINK_BUILD.stamp)
endif()
if(QSERIAL_BUILD_FROM_SOURCE)
# qserial headers without Q_OBJECT
# r !grep -RL Q_OBJECT thirdParty/qserial/include
set (qserialHdrs
thirdParty/qserial/include/QtSerialPort/qserialport_export.h
thirdParty/qserial/include/QtSerialPort/QSerialPort
thirdParty/qserial/include/QtSerialPort/qportsettings.h
if(QSERIALPORT_BUILD_FROM_SOURCE)
# qserialport headers without Q_OBJECT
# r !grep -RL Q_OBJECT thirdParty/qserialport/include
set (qserialportHdrs
thirdParty/qserialport/include/QtSerialPort/qserialport_export.h
thirdParty/qserialport/include/QtSerialPort/qserialport
thirdParty/qserialport/include/QtSerialPort/qportsettings.h
)
# qserial headers with Q_OBJECT
# r !grep -Rl Q_OBJECT thirdParty/qserial
set (qserialMocSrc
thirdParty/qserial/include/QtSerialPort/qserialport.h
thirdParty/qserial/include/QtSerialPort/qserialportnative.h
# qserialport headers with Q_OBJECT
# r !grep -Rl Q_OBJECT thirdParty/qserialport
set (qserialportMocSrc
thirdParty/qserialport/include/QtSerialPort/qserialport.h
thirdParty/qserialport/include/QtSerialPort/qserialportnative.h
)
# qserial src
set (qserialSrc
thirdParty/qserial/src/common/qserialport.cpp
thirdParty/qserial/src/common/qportsettings.cpp
# qserialport src
set (qserialportSrc
thirdParty/qserialport/src/common/qserialport.cpp
thirdParty/qserialport/src/common/qportsettings.cpp
)
# qserial native code
# qserialport native code
if (WIN32)
list(APPEND qserialHdrs
thirdParty/qserial/src/win32/commdcbhelper.h
list(APPEND qserialportHdrs
thirdParty/qserialport/src/win32/commdcbhelper.h
)
list(APPEND qserialMocSrc
thirdParty/qserial/src/win32/qwincommevtnotifier.h
thirdParty/qserial/src/win32/wincommevtbreaker.h
list(APPEND qserialportMocSrc
thirdParty/qserialport/src/win32/qwincommevtnotifier.h
thirdParty/qserialport/src/win32/wincommevtbreaker.h
)
list(APPEND qserialSrc
thirdParty/qserial/src/win32/qserialportnative_win32.cpp
thirdParty/qserial/src/win32/commdcbhelper.cpp
thirdParty/qserial/src/win32/qwincommevtnotifier.cpp
#thirdParty/qserial/src/win32/qserialportnative_wince.cpp
#thirdParty/qserial/src/win32/wincommevtbreaker.cpp
list(APPEND qserialportSrc
thirdParty/qserialport/src/win32/qserialportnative_win32.cpp
thirdParty/qserialport/src/win32/commdcbhelper.cpp
thirdParty/qserialport/src/win32/qwincommevtnotifier.cpp
#thirdParty/qserialport/src/win32/qserialportnative_wince.cpp
#thirdParty/qserialport/src/win32/wincommevtbreaker.cpp
)
elseif(UNIX OR APPLE)
list(APPEND qserialHdrs
thirdParty/qserial/src/posix/termioshelper.h
list(APPEND qserialportHdrs
thirdParty/qserialport/src/posix/termioshelper.h
)
list(APPEND qserialSrc
thirdParty/qserial/src/posix/termioshelper.cpp
thirdParty/qserial/src/posix/qserialportnative_posix.cpp
list(APPEND qserialportSrc
thirdParty/qserialport/src/posix/termioshelper.cpp
thirdParty/qserialport/src/posix/qserialportnative_posix.cpp
)
else()
message(FATAL_ERROR "unknown OS")
endif()
# qserial linking
qt4_wrap_cpp(qserialMoc ${qserialMocSrc})
add_library(qserial ${qserialMoc} ${qserialSrc})
target_link_libraries(qserial ${QT_LIBRARIES})
# qserialport linking
qt4_wrap_cpp(qserialportMoc ${qserialportMocSrc})
add_library(qserialport ${qserialportMoc} ${qserialportSrc})
target_link_libraries(qserialport ${QT_LIBRARIES})
set(QSERIAL_INCLUDE_DIRS
${PROJECT_SOURCE_DIR}/thirdParty/qserial/include
${PROJECT_SOURCE_DIR}/thirdParty/qserial/include/QtSerialPort
${PROJECT_SOURCE_DIR}/thirdParty/qserial/src
set(QSERIALPORT_INCLUDE_DIRS
${PROJECT_SOURCE_DIR}/thirdParty/qserialport/include
${PROJECT_SOURCE_DIR}/thirdParty/qserialport/include/QtSerialPort
${PROJECT_SOURCE_DIR}/thirdParty/qserialport/src
)
set(QSERIAL_LIBRARIES qserial)
add_custom_command(OUTPUT QSERIAL_BUILD.stamp
COMMAND touch QSERIAL_BUILD.stamp)
set(QSERIALPORT_LIBRARIES qserialport)
add_custom_command(OUTPUT qserialport_BUILD.stamp
COMMAND touch qserialport_BUILD.stamp)
endif()
# data directory
......@@ -249,10 +249,10 @@ if (MAVLINK_FOUND)
list(APPEND qgroundcontrolIncludes ${MAVLINK_INCLUDE_DIRS})
endif()
message(STATUS "\t\tQSERIAL\t\t${QSERIAL_FOUND}")
if (QSERIAL_FOUND)
list(APPEND qgroundcontrolIncludes ${QSERIAL_INCLUDE_DIRS})
list(APPEND qgroundcontrolLibs ${QSERIAL_LIBRARIES})
message(STATUS "\t\tqserialport\t${QSERIALPORT_FOUND}")
if (QSERIALPORT_FOUND)
list(APPEND qgroundcontrolIncludes ${QSERIALPORT_INCLUDE_DIRS})
list(APPEND qgroundcontrolLibs ${QSERIALPORT_LIBRARIES})
endif()
message(STATUS "\t\tOpenSceneGraph\t${OPENSCENEGRAPH_FOUND}")
......
# - Try to find QSERIAL
# - Try to find QSERIALPORT
# Once done, this will define
#
# QSERIAL_FOUND - system has scicoslab
# QSERIAL_INCLUDE_DIRS - the scicoslab include directories
# QSERIAL_LIBRARIES - libraries to link to
# QSERIALPORT_FOUND - system has scicoslab
# QSERIALPORT_INCLUDE_DIRS - the scicoslab include directories
# QSERIALPORT_LIBRARIES - libraries to link to
include(LibFindMacros)
# Include dir
find_path(QSERIAL_INCLUDE_DIR
find_path(QSERIALPORT_INCLUDE_DIR
NAMES QSerialPort
PATHS
/usr/include/QtSerialPort
......@@ -17,7 +17,7 @@ find_path(QSERIAL_INCLUDE_DIR
)
# Finally the library itself
find_library(QSERIAL_LIBRARY
find_library(QSERIALPORT_LIBRARY
NAMES
QtSerialPort
PATHS
......@@ -28,6 +28,6 @@ find_library(QSERIAL_LIBRARY
# Set the include dir variables and the libraries and let libfind_process do the rest.
# NOTE: Singular variables for this library, plural for libraries this this lib depends on.
set(QSERIAL_PROCESS_INCLUDES QSERIAL_INCLUDE_DIR)
set(QSERIAL_PROCESS_LIBS QSERIAL_LIBRARY QSERIAL_LIBRARIES)
libfind_process(QSERIAL)
set(QSERIALPORT_PROCESS_INCLUDES QSERIALPORT_INCLUDE_DIR)
set(QSERIALPORT_PROCESS_LIBS QSERIALPORT_LIBRARY QSERIALPORT_LIBRARIES)
libfind_process(QSERIALPORT)
......@@ -390,14 +390,14 @@ void MAVLinkProtocol::sendHeartbeat()
mavlink_msg_heartbeat_pack(getSystemId(), getComponentId(),&beat, OCU, MAV_AUTOPILOT_GENERIC);
sendMessage(beat);
}
if (m_authEnabled) {
mavlink_message_t msg;
mavlink_auth_key_t auth;
if (m_authKey.length() != MAVLINK_MSG_AUTH_KEY_FIELD_KEY_LEN) m_authKey.resize(MAVLINK_MSG_AUTH_KEY_FIELD_KEY_LEN);
strcpy(auth.key, m_authKey.toStdString().c_str());
mavlink_msg_auth_key_encode(getSystemId(), getComponentId(), &msg, &auth);
sendMessage(msg);
}
//if (m_authEnabled) {
//mavlink_message_t msg;
//mavlink_auth_key_t auth;
//if (m_authKey.length() != MAVLINK_MSG_AUTH_KEY_FIELD_KEY_LEN) m_authKey.resize(MAVLINK_MSG_AUTH_KEY_FIELD_KEY_LEN);
//strcpy(auth.key, m_authKey.toStdString().c_str());
//mavlink_msg_auth_key_encode(getSystemId(), getComponentId(), &msg, &auth);
//sendMessage(msg);
//}
}
/** @param enabled true to enable heartbeats emission at heartbeatRate, false to disable */
......
......@@ -690,15 +690,15 @@ void UAS::receiveMessage(LinkInterface* link, mavlink_message_t message)
}
break;
case MAVLINK_MSG_ID_SCALED_PRESSURE: {
mavlink_scaled_pressure_t pressure;
mavlink_msg_scaled_pressure_decode(&message, &pressure);
quint64 time = this->getUnixTime(pressure.usec);
emit valueChanged(uasId, "abs pressure", "hPa", pressure.press_abs, time);
emit valueChanged(uasId, "diff pressure", "hPa", pressure.press_diff, time);
emit valueChanged(uasId, "temperature", "C", pressure.temperature/100.0, time);
}
break;
//case MAVLINK_MSG_ID_SCALED_PRESSURE: {
//mavlink_scaled_pressure_t pressure;
//mavlink_msg_scaled_pressure_decode(&message, &pressure);
//quint64 time = this->getUnixTime(pressure.usec);
//emit valueChanged(uasId, "abs pressure", "hPa", pressure.press_abs, time);
//emit valueChanged(uasId, "diff pressure", "hPa", pressure.press_diff, time);
//emit valueChanged(uasId, "temperature", "C", pressure.temperature/100.0, time);
//}
//break;
case MAVLINK_MSG_ID_RC_CHANNELS_RAW: {
mavlink_rc_channels_raw_t channels;
......@@ -1304,10 +1304,10 @@ void UAS::getStatusForCode(int statusCode, QString& uasState, QString& stateDesc
uasState = tr("EMERGENCY");
stateDescription = tr("EMERGENCY: Land Immediately!");
break;
case MAV_STATE_HILSIM:
uasState = tr("HIL SIM");
stateDescription = tr("HIL Simulation, Sensors read from SIM");
break;
//case MAV_STATE_HILSIM:
//uasState = tr("HIL SIM");
//stateDescription = tr("HIL Simulation, Sensors read from SIM");
//break;
case MAV_STATE_POWEROFF:
uasState = tr("SHUTDOWN");
......@@ -1975,24 +1975,24 @@ bool UAS::emergencyKILL()
void UAS::startHil()
{
mavlink_message_t msg;
// TODO Replace MG System ID with static function call and allow to change ID in GUI
mavlink_msg_action_pack(MG::SYSTEM::ID, MG::SYSTEM::COMPID, &msg, this->getUASID(), MAV_COMP_ID_IMU,(int)MAV_ACTION_START_HILSIM);
// Send message twice to increase chance of reception
sendMessage(msg);
sendMessage(msg);
//mavlink_message_t msg;
//// TODO Replace MG System ID with static function call and allow to change ID in GUI
//mavlink_msg_action_pack(MG::SYSTEM::ID, MG::SYSTEM::COMPID, &msg, this->getUASID(), MAV_COMP_ID_IMU,(int)MAV_ACTION_START_HILSIM);
//// Send message twice to increase chance of reception
//sendMessage(msg);
//sendMessage(msg);
}
void UAS::stopHil()
{
mavlink_message_t msg;
// TODO Replace MG System ID with static function call and allow to change ID in GUI
mavlink_msg_action_pack(MG::SYSTEM::ID, MG::SYSTEM::COMPID, &msg, this->getUASID(), MAV_COMP_ID_IMU,(int)MAV_ACTION_STOP_HILSIM);
// Send message twice to increase chance of reception
sendMessage(msg);
sendMessage(msg);
//mavlink_message_t msg;
//// TODO Replace MG System ID with static function call and allow to change ID in GUI
//mavlink_msg_action_pack(MG::SYSTEM::ID, MG::SYSTEM::COMPID, &msg, this->getUASID(), MAV_COMP_ID_IMU,(int)MAV_ACTION_STOP_HILSIM);
//// Send message twice to increase chance of reception
//sendMessage(msg);
//sendMessage(msg);
}
......
......@@ -4,9 +4,11 @@ PS3='Please enter your choice: '
LIST="all mavlink qserialport end"
echo
echo this script grabs upstream releases
echo
function fetch_qserialport
{
echo
rm -rf qserialport
git clone git://gitorious.org/inbiza-labs/qserialport.git
rm -rf qserialport/.git
......@@ -14,8 +16,7 @@ function fetch_qserialport
function fetch_mavlink
{
echo you chose mavlink
echo fetching mavlink
echo
rm -rf mavlink
git clone git@github.com:openmav/mavlink.git
rm -rf mavlink/.git
......
/** @file
* @brief MAVLink comm protocol.
* @see http://pixhawk.ethz.ch/software/mavlink
* Generated on Tuesday, February 15 2011, 15:57 UTC
* Generated on Thursday, March 31 2011, 22:06 UTC
*/
#ifndef ARDUPILOTMEGA_H
#define ARDUPILOTMEGA_H
......
/** @file
* @brief MAVLink comm protocol.
* @see http://pixhawk.ethz.ch/software/mavlink
* Generated on Tuesday, February 15 2011, 15:57 UTC
* Generated on Thursday, March 31 2011, 22:06 UTC
*/
#ifndef MAVLINK_H
#define MAVLINK_H
......
/** @file
* @brief MAVLink comm protocol.
* @see http://pixhawk.ethz.ch/software/mavlink
* Generated on Wednesday, March 2 2011, 13:12 UTC
* Generated on Thursday, March 31 2011, 22:06 UTC
*/
#ifndef COMMON_H
#define COMMON_H
......@@ -87,6 +87,7 @@ enum MAV_DATA_STREAM
#include "./mavlink_msg_system_time_utc.h"
#include "./mavlink_msg_change_operator_control.h"
#include "./mavlink_msg_change_operator_control_ack.h"
#include "./mavlink_msg_auth_key.h"
#include "./mavlink_msg_action_ack.h"
#include "./mavlink_msg_action.h"
#include "./mavlink_msg_set_mode.h"
......@@ -100,6 +101,7 @@ enum MAV_DATA_STREAM
#include "./mavlink_msg_gps_status.h"
#include "./mavlink_msg_raw_imu.h"
#include "./mavlink_msg_raw_pressure.h"
#include "./mavlink_msg_scaled_pressure.h"
#include "./mavlink_msg_attitude.h"
#include "./mavlink_msg_local_position.h"
#include "./mavlink_msg_global_position.h"
......
/** @file
* @brief MAVLink comm protocol.
* @see http://pixhawk.ethz.ch/software/mavlink
* Generated on Wednesday, March 2 2011, 13:12 UTC
* Generated on Thursday, March 31 2011, 22:06 UTC
*/
#ifndef MAVLINK_H
#define MAVLINK_H
......
......@@ -6,9 +6,9 @@ typedef struct __mavlink_gps_set_global_origin_t
{
uint8_t target_system; ///< System ID
uint8_t target_component; ///< Component ID
uint32_t latitude; ///< global position * 1E7
uint32_t longitude; ///< global position * 1E7
uint32_t altitude; ///< global position * 1000
int32_t latitude; ///< global position * 1E7
int32_t longitude; ///< global position * 1E7
int32_t altitude; ///< global position * 1000
} mavlink_gps_set_global_origin_t;
......@@ -27,16 +27,16 @@ typedef struct __mavlink_gps_set_global_origin_t
* @param altitude global position * 1000
* @return length of the message in bytes (excluding serial stream start sign)
*/
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, uint32_t latitude, uint32_t longitude, uint32_t altitude)
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;
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_uint32_t_by_index(latitude, i, msg->payload); // global position * 1E7
i += put_uint32_t_by_index(longitude, i, msg->payload); // global position * 1E7
i += put_uint32_t_by_index(altitude, i, msg->payload); // global position * 1000
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
return mavlink_finalize_message(msg, system_id, component_id, i);
}
......@@ -54,16 +54,16 @@ static inline uint16_t mavlink_msg_gps_set_global_origin_pack(uint8_t system_id,
* @param altitude global position * 1000
* @return length of the message in bytes (excluding serial stream start sign)
*/
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, uint32_t latitude, uint32_t longitude, uint32_t altitude)
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;
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_uint32_t_by_index(latitude, i, msg->payload); // global position * 1E7
i += put_uint32_t_by_index(longitude, i, msg->payload); // global position * 1E7
i += put_uint32_t_by_index(altitude, i, msg->payload); // global position * 1000
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
return mavlink_finalize_message_chan(msg, system_id, component_id, chan, i);
}
......@@ -93,7 +93,7 @@ static inline uint16_t mavlink_msg_gps_set_global_origin_encode(uint8_t system_i
*/
#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, uint32_t latitude, uint32_t longitude, uint32_t altitude)
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);
......@@ -128,14 +128,14 @@ static inline uint8_t mavlink_msg_gps_set_global_origin_get_target_component(con
*
* @return global position * 1E7
*/
static inline uint32_t mavlink_msg_gps_set_global_origin_get_latitude(const mavlink_message_t* msg)
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 (uint32_t)r.i;
return (int32_t)r.i;
}
/**
......@@ -143,14 +143,14 @@ static inline uint32_t mavlink_msg_gps_set_global_origin_get_latitude(const mavl
*
* @return global position * 1E7
*/
static inline uint32_t mavlink_msg_gps_set_global_origin_get_longitude(const mavlink_message_t* msg)
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(uint32_t))[0];
r.b[2] = (msg->payload+sizeof(uint8_t)+sizeof(uint8_t)+sizeof(uint32_t))[1];
r.b[1] = (msg->payload+sizeof(uint8_t)+sizeof(uint8_t)+sizeof(uint32_t))[2];
r.b[0] = (msg->payload+sizeof(uint8_t)+sizeof(uint8_t)+sizeof(uint32_t))[3];
return (uint32_t)r.i;
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;
}
/**
......@@ -158,14 +158,14 @@ static inline uint32_t mavlink_msg_gps_set_global_origin_get_longitude(const mav
*
* @return global position * 1000
*/
static inline uint32_t mavlink_msg_gps_set_global_origin_get_altitude(const mavlink_message_t* msg)
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(uint32_t)+sizeof(uint32_t))[0];
r.b[2] = (msg->payload+sizeof(uint8_t)+sizeof(uint8_t)+sizeof(uint32_t)+sizeof(uint32_t))[1];
r.b[1] = (msg->payload+sizeof(uint8_t)+sizeof(uint8_t)+sizeof(uint32_t)+sizeof(uint32_t))[2];
r.b[0] = (msg->payload+sizeof(uint8_t)+sizeof(uint8_t)+sizeof(uint32_t)+sizeof(uint32_t))[3];
return (uint32_t)r.i;
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;
}
/**
......
......@@ -5,10 +5,10 @@
typedef struct __mavlink_raw_pressure_t
{
uint64_t usec; ///< Timestamp (microseconds since UNIX epoch or microseconds since system boot)
float press_abs; ///< Absolute pressure (hectopascal)
float press_diff1; ///< Differential pressure 1 (hectopascal)
float press_diff2; ///< Differential pressure 2 (hectopascal)
int16_t temperature; ///< Raw Temperature measurement (0.01 degrees celsius per tick is default unit)
int16_t press_abs; ///< Absolute pressure (raw)
int16_t press_diff1; ///< Differential pressure 1 (raw)
int16_t press_diff2; ///< Differential pressure 2 (raw)
int16_t temperature; ///< Raw Temperature measurement (raw)
} mavlink_raw_pressure_t;
......@@ -21,22 +21,22 @@ typedef struct __mavlink_raw_pressure_t
* @param msg The MAVLink message to compress the data into
*
* @param usec Timestamp (microseconds since UNIX epoch or microseconds since system boot)
* @param press_abs Absolute pressure (hectopascal)
* @param press_diff1 Differential pressure 1 (hectopascal)
* @param press_diff2 Differential pressure 2 (hectopascal)
* @param temperature Raw Temperature measurement (0.01 degrees celsius per tick is default unit)
* @param press_abs Absolute pressure (raw)
* @param press_diff1 Differential pressure 1 (raw)
* @param press_diff2 Differential pressure 2 (raw)
* @param temperature Raw Temperature measurement (raw)
* @return length of the message in bytes (excluding serial stream start sign)
*/
static inline uint16_t mavlink_msg_raw_pressure_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, uint64_t usec, float press_abs, float press_diff1, float press_diff2, int16_t temperature)
static inline uint16_t mavlink_msg_raw_pressure_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, uint64_t usec, int16_t press_abs, int16_t press_diff1, int16_t press_diff2, int16_t temperature)
{
uint16_t i = 0;
msg->msgid = MAVLINK_MSG_ID_RAW_PRESSURE;
i += put_uint64_t_by_index(usec, i, msg->payload); // Timestamp (microseconds since UNIX epoch or microseconds since system boot)
i += put_float_by_index(press_abs, i, msg->payload); // Absolute pressure (hectopascal)
i += put_float_by_index(press_diff1, i, msg->payload); // Differential pressure 1 (hectopascal)
i += put_float_by_index(press_diff2, i, msg->payload); // Differential pressure 2 (hectopascal)
i += put_int16_t_by_index(temperature, i, msg->payload); // Raw Temperature measurement (0.01 degrees celsius per tick is default unit)
i += put_int16_t_by_index(press_abs, i, msg->payload); // Absolute pressure (raw)
i += put_int16_t_by_index(press_diff1, i, msg->payload); // Differential pressure 1 (raw)
i += put_int16_t_by_index(press_diff2, i, msg->payload); // Differential pressure 2 (raw)
i += put_int16_t_by_index(temperature, i, msg->payload); // Raw Temperature measurement (raw)
return mavlink_finalize_message(msg, system_id, component_id, i);
}
......@@ -48,22 +48,22 @@ static inline uint16_t mavlink_msg_raw_pressure_pack(uint8_t system_id, uint8_t
* @param chan The MAVLink channel this message was sent over
* @param msg The MAVLink message to compress the data into
* @param usec Timestamp (microseconds since UNIX epoch or microseconds since system boot)
* @param press_abs Absolute pressure (hectopascal)
* @param press_diff1 Differential pressure 1 (hectopascal)
* @param press_diff2 Differential pressure 2 (hectopascal)
* @param temperature Raw Temperature measurement (0.01 degrees celsius per tick is default unit)
* @param press_abs Absolute pressure (raw)
* @param press_diff1 Differential pressure 1 (raw)
* @param press_diff2 Differential pressure 2 (raw)
* @param temperature Raw Temperature measurement (raw)
* @return length of the message in bytes (excluding serial stream start sign)
*/
static inline uint16_t mavlink_msg_raw_pressure_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, uint64_t usec, float press_abs, float press_diff1, float press_diff2, int16_t temperature)
static inline uint16_t mavlink_msg_raw_pressure_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, uint64_t usec, int16_t press_abs, int16_t press_diff1, int16_t press_diff2, int16_t temperature)
{
uint16_t i = 0;
msg->msgid = MAVLINK_MSG_ID_RAW_PRESSURE;
i += put_uint64_t_by_index(usec, i, msg->payload); // Timestamp (microseconds since UNIX epoch or microseconds since system boot)
i += put_float_by_index(press_abs, i, msg->payload); // Absolute pressure (hectopascal)
i += put_float_by_index(press_diff1, i, msg->payload); // Differential pressure 1 (hectopascal)
i += put_float_by_index(press_diff2, i, msg->payload); // Differential pressure 2 (hectopascal)
i += put_int16_t_by_index(temperature, i, msg->payload); // Raw Temperature measurement (0.01 degrees celsius per tick is default unit)
i += put_int16_t_by_index(press_abs, i, msg->payload); // Absolute pressure (raw)
i += put_int16_t_by_index(press_diff1, i, msg->payload); // Differential pressure 1 (raw)
i += put_int16_t_by_index(press_diff2, i, msg->payload); // Differential pressure 2 (raw)
i += put_int16_t_by_index(temperature, i, msg->payload); // Raw Temperature measurement (raw)
return mavlink_finalize_message_chan(msg, system_id, component_id, chan, i);
}
......@@ -86,14 +86,14 @@ static inline uint16_t mavlink_msg_raw_pressure_encode(uint8_t system_id, uint8_
* @param chan MAVLink channel to send the message
*
* @param usec Timestamp (microseconds since UNIX epoch or microseconds since system boot)
* @param press_abs Absolute pressure (hectopascal)
* @param press_diff1 Differential pressure 1 (hectopascal)
* @param press_diff2 Differential pressure 2 (hectopascal)
* @param temperature Raw Temperature measurement (0.01 degrees celsius per tick is default unit)
* @param press_abs Absolute pressure (raw)
* @param press_diff1 Differential pressure 1 (raw)
* @param press_diff2 Differential pressure 2 (raw)
* @param temperature Raw Temperature measurement (raw)
*/
#ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS
static inline void mavlink_msg_raw_pressure_send(mavlink_channel_t chan, uint64_t usec, float press_abs, float press_diff1, float press_diff2, int16_t temperature)
static inline void mavlink_msg_raw_pressure_send(mavlink_channel_t chan, uint64_t usec, int16_t press_abs, int16_t press_diff1, int16_t press_diff2, int16_t temperature)
{
mavlink_message_t msg;
mavlink_msg_raw_pressure_pack_chan(mavlink_system.sysid, mavlink_system.compid, chan, &msg, usec, press_abs, press_diff1, press_diff2, temperature);
......@@ -125,58 +125,52 @@ static inline uint64_t mavlink_msg_raw_pressure_get_usec(const mavlink_message_t
/**
* @brief Get field press_abs from raw_pressure message
*
* @return Absolute pressure (hectopascal)
* @return Absolute pressure (raw)
*/
static inline float mavlink_msg_raw_pressure_get_press_abs(const mavlink_message_t* msg)
static inline int16_t mavlink_msg_raw_pressure_get_press_abs(const mavlink_message_t* msg)
{
generic_32bit r;
r.b[3] = (msg->payload+sizeof(uint64_t))[0];
r.b[2] = (msg->payload+sizeof(uint64_t))[1];
r.b[1] = (msg->payload+sizeof(uint64_t))[2];
r.b[0] = (msg->payload+sizeof(uint64_t))[3];
return (float)r.f;
generic_16bit r;
r.b[1] = (msg->payload+sizeof(uint64_t))[0];
r.b[0] = (msg->payload+sizeof(uint64_t))[1];
return (int16_t)r.s;
}
/**
* @brief Get field press_diff1 from raw_pressure message
*
* @return Differential pressure 1 (hectopascal)
* @return Differential pressure 1 (raw)
*/
static inline float mavlink_msg_raw_pressure_get_press_diff1(const mavlink_message_t* msg)
static inline int16_t mavlink_msg_raw_pressure_get_press_diff1(const mavlink_message_t* msg)
{
generic_32bit r;
r.b[3] = (msg->payload+sizeof(uint64_t)+sizeof(float))[0];
r.b[2] = (msg->payload+sizeof(uint64_t)+sizeof(float))[1];
r.b[1] = (msg->payload+sizeof(uint64_t)+sizeof(float))[2];
r.b[0] = (msg->payload+sizeof(uint64_t)+sizeof(float))[3];
return (float)r.f;
generic_16bit r;
r.b[1] = (msg->payload+sizeof(uint64_t)+sizeof(int16_t))[0];
r.b[0] = (msg->payload+sizeof(uint64_t)+sizeof(int16_t))[1];
return (int16_t)r.s;
}
/**
* @brief Get field press_diff2 from raw_pressure message
*
* @return Differential pressure 2 (hectopascal)
* @return Differential pressure 2 (raw)
*/
static inline float mavlink_msg_raw_pressure_get_press_diff2(const mavlink_message_t* msg)
static inline int16_t mavlink_msg_raw_pressure_get_press_diff2(const mavlink_message_t* msg)
{
generic_32bit r;
r.b[3] = (msg->payload+sizeof(uint64_t)+sizeof(float)+sizeof(float))[0];
r.b[2] = (msg->payload+sizeof(uint64_t)+sizeof(float)+sizeof(float))[1];
r.b[1] = (msg->payload+sizeof(uint64_t)+sizeof(float)+sizeof(float))[2];
r.b[0] = (msg->payload+sizeof(uint64_t)+sizeof(float)+sizeof(float))[3];
return (float)r.f;
generic_16bit r;
r.b[1] = (msg->payload+sizeof(uint64_t)+sizeof(int16_t)+sizeof(int16_t))[0];
r.b[0] = (msg->payload+sizeof(uint64_t)+sizeof(int16_t)+sizeof(int16_t))[1];
return (int16_t)r.s;
}
/**
* @brief Get field temperature from raw_pressure message
*
* @return Raw Temperature measurement (0.01 degrees celsius per tick is default unit)
* @return Raw Temperature measurement (raw)
*/
static inline int16_t mavlink_msg_raw_pressure_get_temperature(const mavlink_message_t* msg)
{
generic_16bit r;
r.b[1] = (msg->payload+sizeof(uint64_t)+sizeof(float)+sizeof(float)+sizeof(float))[0];
r.b[0] = (msg->payload+sizeof(uint64_t)+sizeof(float)+sizeof(float)+sizeof(float))[1];
r.b[1] = (msg->payload+sizeof(uint64_t)+sizeof(int16_t)+sizeof(int16_t)+sizeof(int16_t))[0];
r.b[0] = (msg->payload+sizeof(uint64_t)+sizeof(int16_t)+sizeof(int16_t)+sizeof(int16_t))[1];
return (int16_t)r.s;
}
......
// MESSAGE REQUEST_DYNAMIC_GYRO_CALIBRATION PACKING
#define MAVLINK_MSG_ID_REQUEST_DYNAMIC_GYRO_CALIBRATION 67
typedef struct __mavlink_request_dynamic_gyro_calibration_t
{
uint8_t target_system; ///< The system which should auto-calibrate
uint8_t target_component; ///< The system component which should auto-calibrate
float mode; ///< The current ground-truth rpm
uint8_t axis; ///< The axis to calibrate: 0 roll, 1 pitch, 2 yaw
uint16_t time; ///< The time to average over in ms
} mavlink_request_dynamic_gyro_calibration_t;
/**
* @brief Pack a request_dynamic_gyro_calibration message
* @param system_id ID of this system
* @param component_id ID of this component (e.g. 200 for IMU)
* @param msg The MAVLink message to compress the data into
*