1
0
mirror of https://bitbucket.org/librepilot/librepilot.git synced 2025-01-19 04:52:12 +01:00

Merged in f5soh/librepilot/LP-354_Ublox_AssistNowAutonomous (pull request #273)

LP-354 Add Ublox AssistNowAutonomous setting
This commit is contained in:
Alessio Morale 2016-07-05 19:41:43 +02:00
commit f4bc8e0c33
11 changed files with 121 additions and 41 deletions

View File

@ -2,7 +2,7 @@
******************************************************************************
* @addtogroup OpenPilotModules OpenPilot Modules
* @{
* @addtogroup GSPModule GPS Module
* @addtogroup GPSModule GPS Module
* @brief Process GPS information (DJI-Naza binary format)
* @{
*

View File

@ -2,14 +2,14 @@
******************************************************************************
* @addtogroup OpenPilotModules OpenPilot Modules
* @{
* @addtogroup GSPModule GPS Module
* @addtogroup GPSModule GPS Module
* @brief Process GPS information
* @{
*
* @file GPS.c
* @author The LibrePilot Project, http://www.librepilot.org Copyright (C) 2016.
* The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
* @brief GPS module, handles GPS and NMEA stream
* @brief GPS module, handles GPS and various streams
* @see The GNU Public License (GPL) Version 3
*
*****************************************************************************/
@ -669,6 +669,7 @@ void updateGpsSettings(__attribute__((unused)) UAVObjEvent *ev)
// because ubx auto config never gets called
// setting it up completely means that if we switch from the other protocol to UBX or disabled to enabled, that it will start normally
newconfig.UbxAutoConfig = gpsSettings.UbxAutoConfig;
newconfig.AssistNowAutonomous = gpsSettings.UbxAssistNowAutonomous;
newconfig.navRate = gpsSettings.UbxRate;
newconfig.dynamicModel = gpsSettings.UbxDynamicModel == GPSSETTINGS_UBXDYNAMICMODEL_PORTABLE ? UBX_DYNMODEL_PORTABLE :
gpsSettings.UbxDynamicModel == GPSSETTINGS_UBXDYNAMICMODEL_STATIONARY ? UBX_DYNMODEL_STATIONARY :

View File

@ -2,8 +2,8 @@
******************************************************************************
* @addtogroup OpenPilotModules OpenPilot Modules
* @{
* @addtogroup GSPModule GPS Module
* @brief Process GPS information
* @addtogroup GPSModule GPS Module
* @brief Process GPS information (NMEA format)
* @{
*
* @file NMEA.c

View File

@ -2,14 +2,14 @@
******************************************************************************
* @addtogroup OpenPilotModules OpenPilot Modules
* @{
* @addtogroup GSPModule GPS Module
* @addtogroup GPSModule GPS Module
* @brief Process GPS information (UBX binary format)
* @{
*
* @file UBX.c
* @author The LibrePilot Project, http://www.librepilot.org Copyright (C) 2015-2016.
* The OpenPilot Team, http://www.openpilot.org Copyright (C) 2012.
* @brief GPS module, handles GPS and NMEA stream
* @brief GPS module, handles GPS and UBX stream
* @see The GNU Public License (GPL) Version 3
*
*****************************************************************************/

View File

@ -2,8 +2,8 @@
******************************************************************************
* @addtogroup OpenPilotModules OpenPilot Modules
* @{
* @addtogroup GSPModule GPS Module
* @brief Process GPS information
* @addtogroup GPSModule GPS Module
* @brief Process GPS information (DJI-Naza binary format)
* @{
*
* @file DJI.h

View File

@ -2,7 +2,7 @@
******************************************************************************
* @addtogroup OpenPilotModules OpenPilot Modules
* @{
* @addtogroup GSPModule GPS Module
* @addtogroup GPSModule GPS Module
* @brief Process GPS information
* @{
*

View File

@ -2,8 +2,8 @@
******************************************************************************
* @addtogroup OpenPilotModules OpenPilot Modules
* @{
* @addtogroup GSPModule GPS Module
* @brief Process GPS information
* @addtogroup GPSModule GPS Module
* @brief Process GPS information (NMEA format)
* @{
*
* @file NMEA.h

View File

@ -2,14 +2,14 @@
******************************************************************************
* @addtogroup OpenPilotModules OpenPilot Modules
* @{
* @addtogroup GSPModule GPS Module
* @brief Process GPS information
* @addtogroup GPSModule GPS Module
* @brief Process GPS information (UBX binary format)
* @{
*
* @file UBX.h
* @author The LibrePilot Project, http://www.librepilot.org Copyright (C) 2015-2016.
* The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
* @brief GPS module, handles GPS and NMEA stream
* @brief GPS module, handles GPS and UBX stream
* @see The GNU Public License (GPL) Version 3
*
*****************************************************************************/
@ -42,6 +42,8 @@
#define UBX_HW_VERSION_8 80000
#define UBX_HW_VERSION_7 70000
#define UBX_HW_VERSION_6 60000
#define UBX_HW_VERSION_5 50000
#define UBX_SYNC1 0xb5 // UBX protocol synchronization characters
#define UBX_SYNC2 0x62
@ -98,13 +100,14 @@ typedef enum {
} ubx_class_mon_id;
typedef enum {
UBX_ID_CFG_NAV5 = 0x24,
UBX_ID_CFG_RATE = 0x08,
UBX_ID_CFG_MSG = 0x01,
UBX_ID_CFG_CFG = 0x09,
UBX_ID_CFG_SBAS = 0x16,
UBX_ID_CFG_GNSS = 0x3E,
UBX_ID_CFG_PRT = 0x00
UBX_ID_CFG_NAV5 = 0x24,
UBX_ID_CFG_NAVX5 = 0x23,
UBX_ID_CFG_RATE = 0x08,
UBX_ID_CFG_MSG = 0x01,
UBX_ID_CFG_CFG = 0x09,
UBX_ID_CFG_SBAS = 0x16,
UBX_ID_CFG_GNSS = 0x3E,
UBX_ID_CFG_PRT = 0x00
} ubx_class_cfg_id;
typedef enum {
@ -502,6 +505,21 @@ struct UBX_CFG_GNSS {
struct UBX_CFG_GNSS_CFGBLOCK cfgBlocks[UBX_GNSS_ID_MAX];
} __attribute__((packed));
// CFG-NAV5: Position Fixing Mode
#define UBX_CFG_NAV5_FIXMODE_2D_ONLY 0x01
#define UBX_CFG_NAV5_FIXMODE_3D_ONLY 0x02
#define UBX_CFG_NAV5_FIXMODE_AUTO_2D3D 0x03
// CFG-NAV5: Bitfield mask
#define UBX_CFG_NAV5_DYNMODEL (1 << 0) // Apply dynamic model settings
#define UBX_CFG_NAV5_MINELEV (1 << 1) // Apply minimum elevation settings
#define UBX_CFG_NAV5_FIXMODE (1 << 2) // Apply fix mode settings
#define UBX_CFG_NAV5_DRLIMIT (1 << 3) // Reserved
#define UBX_CFG_NAV5_POSITION (1 << 4) // Apply position mask settings
#define UBX_CFG_NAV5_TIME (1 << 5) // Apply time mask settings
#define UBX_CFG_NAV5_STATICHOLD (1 << 6) // Apply static hold settings
#define UBX_CFG_NAV5_DGPS (1 << 7) // Reserved
struct UBX_CFG_NAV5 {
uint16_t mask;
uint8_t dynModel;
@ -523,6 +541,41 @@ struct UBX_CFG_NAV5 {
uint32_t reserved4;
} __attribute__((packed));
// CFG-NAVX5: Bitfield mask1
#define UBX_CFG_NAVX5_MIN_MAX (1 << 2) // Apply min/max SVs settings
#define UBX_CFG_NAVX5_MIN_CNO (1 << 3) // Apply minimum C/N0 setting
#define UBX_CFG_NAVX5_INIT_3DFIX (1 << 6) // Apply initial 3D fix settings
#define UBX_CFG_NAVX5_WKN_ROLL (1 << 9) // Apply GPS weeknumber rollover settings
#define UBX_CFG_NAVX5_PPP (1 << 13) // Apply PPP flag, only supported on certain product variants
#define UBX_CFG_NAVX5_AOP (1 << 14) // Apply useAOP flag and aopOrbMaxErr setting (AssistNow Autonomous)
struct UBX_CFG_NAVX5 {
uint16_t version;
uint16_t mask1;
uint32_t reserved0;
uint8_t reserved1;
uint8_t reserved2;
uint8_t minSVs;
uint8_t maxSVs;
uint8_t minCN0;
uint8_t reserved5;
uint8_t iniFix3D;
uint8_t reserved6;
uint8_t reserved7;
uint8_t reserved8;
uint16_t wknRollover;
uint32_t reserved9;
uint8_t reserved10;
uint8_t reserved11;
uint8_t usePPP;
uint8_t useAOP;
uint8_t reserved12;
uint8_t reserved13;
uint16_t aopOrbMaxErr;
uint32_t reserved3;
uint32_t reserved4;
} __attribute__((packed));
// MON message Class
#define UBX_MON_MAX_EXT 5
struct UBX_MON_VER {
@ -599,13 +652,14 @@ union UBXSENTPACKET {
struct {
struct UBXSENTHEADER header;
union {
struct UBX_CFG_CFG cfg_cfg;
struct UBX_CFG_MSG cfg_msg;
struct UBX_CFG_NAV5 cfg_nav5;
struct UBX_CFG_PRT cfg_prt;
struct UBX_CFG_RATE cfg_rate;
struct UBX_CFG_SBAS cfg_sbas;
struct UBX_CFG_GNSS cfg_gnss;
struct UBX_CFG_CFG cfg_cfg;
struct UBX_CFG_MSG cfg_msg;
struct UBX_CFG_NAV5 cfg_nav5;
struct UBX_CFG_NAVX5 cfg_navx5;
struct UBX_CFG_PRT cfg_prt;
struct UBX_CFG_RATE cfg_rate;
struct UBX_CFG_SBAS cfg_sbas;
struct UBX_CFG_GNSS cfg_gnss;
} payload;
uint8_t resvd[2]; // added space for checksum bytes
} message;

View File

@ -1,13 +1,17 @@
/**
******************************************************************************
* @addtogroup OpenPilotModules OpenPilot Modules
* @{
* @addtogroup GPSModule GPS Module
* @brief Support code for UBX AutoConfig
* @{
*
* @file ubx_autoconfig.h
* @author The LibrePilot Project, http://www.librepilot.org Copyright (C) 2016.
* The OpenPilot Team, http://www.openpilot.org Copyright (C) 2014.
* @brief Support code for UBX AutoConfig
* @see The GNU Public License (GPL) Version 3
*
* @file %FILENAME%
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2014.
* @addtogroup [Group]
* @{
* @addtogroup %CLASS%
* @{
* @brief [Brief]
*****************************************************************************/
/*
* This program is free software; you can redistribute it and/or modify
@ -85,6 +89,7 @@ typedef enum {
#define UBX_
typedef struct {
GPSSettingsUbxAutoConfigOptions UbxAutoConfig;
GPSSettingsUbxAssistNowAutonomousOptions AssistNowAutonomous;
bool SBASRanging;
bool SBASCorrection;
bool SBASIntegrity;
@ -102,6 +107,7 @@ typedef struct {
// Sent messages for configuration support
typedef struct UBX_CFG_CFG ubx_cfg_cfg_t;
typedef struct UBX_CFG_NAV5 ubx_cfg_nav5_t;
typedef struct UBX_CFG_NAVX5 ubx_cfg_navx5_t;
typedef struct UBX_CFG_RATE ubx_cfg_rate_t;
typedef struct UBX_CFG_MSG ubx_cfg_msg_t;
typedef struct UBX_CFG_PRT ubx_cfg_prt_t;

View File

@ -2,7 +2,7 @@
******************************************************************************
* @addtogroup OpenPilotModules OpenPilot Modules
* @{
* @addtogroup GSPModule GPS Module
* @addtogroup GPSModule GPS Module
* @brief Support code for UBX AutoConfig
* @{
*
@ -310,13 +310,22 @@ static void config_nav(uint16_t *bytes_to_send)
{
memset((uint8_t *)status->working_packet.buffer, 0, sizeof(UBXSentHeader_t) + sizeof(ubx_cfg_nav5_t));
status->working_packet.message.payload.cfg_nav5.dynModel = status->currentSettings.dynamicModel;
status->working_packet.message.payload.cfg_nav5.fixMode = 2; // 1=2D only, 2=3D only, 3=Auto 2D/3D
status->working_packet.message.payload.cfg_nav5.fixMode = UBX_CFG_NAV5_FIXMODE_3D_ONLY;
// mask LSB=dyn|minEl|posFixMode|drLim|posMask|statisticHoldMask|dgpsMask|......|reservedBit0 = MSB
status->working_packet.message.payload.cfg_nav5.mask = 0x01 + 0x04; // Dyn Model | posFixMode configuration
status->working_packet.message.payload.cfg_nav5.mask = UBX_CFG_NAV5_DYNMODEL + UBX_CFG_NAV5_FIXMODE;
*bytes_to_send = prepare_packet((UBXSentPacket_t *)&status->working_packet, UBX_CLASS_CFG, UBX_ID_CFG_NAV5, sizeof(ubx_cfg_nav5_t));
}
static void config_navx(uint16_t *bytes_to_send)
{
memset((uint8_t *)status->working_packet.buffer, 0, sizeof(UBXSentHeader_t) + sizeof(ubx_cfg_navx5_t));
status->working_packet.message.payload.cfg_navx5.useAOP = status->currentSettings.AssistNowAutonomous;
status->working_packet.message.payload.cfg_navx5.mask1 = UBX_CFG_NAVX5_AOP;
*bytes_to_send = prepare_packet((UBXSentPacket_t *)&status->working_packet, UBX_CLASS_CFG, UBX_ID_CFG_NAVX5, sizeof(ubx_cfg_navx5_t));
}
static void config_sbas(uint16_t *bytes_to_send)
{
@ -409,7 +418,6 @@ static void config_save(uint16_t *bytes_to_send)
*bytes_to_send = prepare_packet((UBXSentPacket_t *)&status->working_packet, UBX_CLASS_CFG, UBX_ID_CFG_CFG, sizeof(ubx_cfg_cfg_t));
}
static void configure(uint16_t *bytes_to_send)
{
switch (status->lastConfigSent) {
@ -423,6 +431,15 @@ static void configure(uint16_t *bytes_to_send)
break;
case LAST_CONFIG_SENT_START + 2:
if (ubxHwVersion > UBX_HW_VERSION_5) {
config_navx(bytes_to_send);
break;
} else {
// Skip and fall through to next step
status->lastConfigSent++;
}
case LAST_CONFIG_SENT_START + 3:
if (status->currentSettings.enableGLONASS || status->currentSettings.enableGPS) {
config_gnss(bytes_to_send);
break;
@ -432,7 +449,7 @@ static void configure(uint16_t *bytes_to_send)
}
// in the else case we must fall through because we must send something each time because successful send is tested externally
case LAST_CONFIG_SENT_START + 3:
case LAST_CONFIG_SENT_START + 4:
config_sbas(bytes_to_send);
break;

View File

@ -19,6 +19,8 @@
<field name="UbxSBASSats" units="" type="enum" elements="1" options="AutoScan,WAAS,EGNOS,MSAS,GAGAN,SDCM" defaultvalue="AutoScan" />
<!-- Ubx GNSS configuration, only applies to Ublox generation 7+ and concurrent GNSS only to generation 8 -->
<field name="UbxGNSSMode" units="" type="enum" elements="1" options="Default,GPS,GLONASS,GPS+GLONASS,GPS+BeiDou,GLONASS+BeiDou" defaultvalue="Default" />
<field name="UbxAssistNowAutonomous" units="" type="enum" elements="1" options="False,True" defaultvalue="True"
description="Enable or disable the AssistNow Autonomous feature"/>
<access gcs="readwrite" flight="readwrite"/>
<telemetrygcs acked="true" updatemode="onchange" period="0"/>
<telemetryflight acked="true" updatemode="onchange" period="0"/>