Skip to content

Commit

Permalink
gnss(septentrio): rework driver
Browse files Browse the repository at this point in the history
Rewrite large parts from the original driver to make the code more
understandable, maintainable, document more items, move related things
into their own files and make the code more consistent.
  • Loading branch information
flyingthingsintothings authored and AlexKlimaj committed Jun 3, 2024
1 parent ddd9d58 commit 8b31220
Show file tree
Hide file tree
Showing 16 changed files with 2,660 additions and 1,228 deletions.
12 changes: 5 additions & 7 deletions msg/GpsDump.msg
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
# This message is used to dump the raw gps communication to the log.
# Set the parameter GPS_DUMP_COMM to 1 to use this.

uint64 timestamp # time since system start (microseconds)
uint64 timestamp # time since system start (microseconds)

uint8 instance # Instance of GNSS receiver

uint8 len # length of data, MSB bit set = message to the gps device,
# clear = message from the device
uint8[79] data # data to write to the log
uint8 instance # Instance of GNSS receiver
uint8 len # length of data, MSB bit set = message to the gps device,
# clear = message from the device
uint8[79] data # data to write to the log

uint8 ORB_QUEUE_LENGTH = 8
9 changes: 8 additions & 1 deletion msg/SensorGps.msg
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,14 @@ float64 altitude_ellipsoid_m # Altitude above Ellipsoid, meters

float32 s_variance_m_s # GPS speed accuracy estimate, (metres/sec)
float32 c_variance_rad # GPS course accuracy estimate, (radians)
uint8 fix_type # 0-1: no fix, 2: 2D fix, 3: 3D fix, 4: RTCM code differential, 5: Real-Time Kinematic, float, 6: Real-Time Kinematic, fixed, 8: Extrapolated. Some applications will not use the value of this field unless it is at least two, so always correctly fill in the fix.
uint8 FIX_TYPE_NONE = 1 # Value 0 is also valid to represent no fix.
uint8 FIX_TYPE_2D = 2
uint8 FIX_TYPE_3D = 3
uint8 FIX_TYPE_RTCM_CODE_DIFFERENTIAL = 4
uint8 FIX_TYPE_RTK_FLOAT = 5
uint8 FIX_TYPE_RTK_FIXED = 6
uint8 FIX_TYPE_EXTRAPOLATED = 8
uint8 fix_type # Some applications will not use the value of this field unless it is at least two, so always correctly fill in the fix.

float32 eph # GPS horizontal position accuracy (metres)
float32 epv # GPS vertical position accuracy (metres)
Expand Down
7 changes: 6 additions & 1 deletion src/drivers/gnss/septentrio/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,16 @@ px4_add_module(
MODULE driver__septentrio
MAIN septentrio
COMPILE_FLAGS
-Wno-stringop-overflow # due to https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91707
# -DDEBUG_BUILD # Enable during development of the module
-DSEP_LOG_ERROR # Enable module-level error logs
# -DSEP_LOG_WARN # Enable module-level warning logs
# -DSEP_LOG_INFO # Enable module-level info logs
# -DSEP_LOG_TRACE_PARSING # Tracing of parsing steps
SRCS
septentrio.cpp
util.cpp
rtcm.cpp
sbf/decoder.cpp
MODULE_CONFIG
module.yaml
)
6 changes: 6 additions & 0 deletions src/drivers/gnss/septentrio/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# Septentrio GNSS Driver

## SBF Library

The `sbf/` directory contains all the logic required to work with SBF, including message
definitions, block IDs and a simple parser for the messages used by PX4.
80 changes: 80 additions & 0 deletions src/drivers/gnss/septentrio/module.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
/****************************************************************************
*
* Copyright (c) 2024 PX4 Development Team. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
* 3. Neither the name PX4 nor the names of its contributors may be
* used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
****************************************************************************/

/**
* @file module.h
*
* Module functionality for the Septentrio GNSS driver.
*
* @author Thomas Frans
*/

#pragma once

#include <px4_platform_common/log.h>

#ifdef DEBUG_BUILD
#ifndef SEP_LOG_ERROR
#define SEP_LOG_ERROR
#endif
#ifndef SEP_LOG_WARN
#define SEP_LOG_WARN
#endif
#ifndef SEP_LOG_INFO
#define SEP_LOG_INFO
#endif
#endif

#ifdef SEP_LOG_ERROR
#define SEP_ERR(...) {PX4_WARN(__VA_ARGS__);}
#else
#define SEP_ERR(...) {}
#endif

#ifdef SEP_LOG_WARN
#define SEP_WARN(...) {PX4_WARN(__VA_ARGS__);}
#else
#define SEP_WARN(...) {}
#endif

#ifdef SEP_LOG_INFO
#define SEP_INFO(...) {PX4_INFO(__VA_ARGS__);}
#else
#define SEP_INFO(...) {}
#endif

#ifdef SEP_LOG_TRACE_PARSING
#define SEP_TRACE_PARSING(...) {PX4_DEBUG(__VA_ARGS__);}
#else
#define SEP_TRACE_PARSING(...) {}
#endif
147 changes: 136 additions & 11 deletions src/drivers/gnss/septentrio/module.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,57 @@ serial_config:
- command: set DUAL_GPS_ARGS "-e ${SERIAL_DEV} -g p:${BAUD_PARAM}"
port_config_param:
name: SEP_PORT2_CFG
group: Septentrio GNSS Receiver
group: Septentrio
label: Secondary GPS port
- command: septentrio start -d ${SERIAL_DEV} -b p:${BAUD_PARAM} ${DUAL_GPS_ARGS}
port_config_param:
name: SEP_PORT1_CFG
group: Septentrio GNSS Receiver
group: Septentrio
default: GPS1
label: GPS Port

parameters:
- group: Septentrio GNSS Receiver
- group: Septentrio
definitions:
SEP_STREAM_MAIN:
description:
short: Main stream used during automatic configuration
long: |
The stream the autopilot sets up on the receiver to output the main data.
Set this to another value if the default stream is already used for another purpose.
type: int32
min: 1
max: 10
default: 1
reboot_required: true
SEP_STREAM_LOG:
description:
short: Logging stream used during automatic configuration
long: |
The stream the autopilot sets up on the receiver to output the logging data.
Set this to another value if the default stream is already used for another purpose.
type: int32
min: 1
max: 10
default: 2
reboot_required: true
SEP_OUTP_HZ:
description:
short: Output frequency of main SBF blocks
long: |
The output frequency of the main SBF blocks needed for PVT information.
type: enum
min: 0
max: 3
default: 1
values:
0: 5 Hz
1: 10 Hz
2: 20 Hz
3: 25 Hz
reboot_required: true
SEP_YAW_OFFS:
description:
short: Heading/Yaw offset for dual antenna GPS
Expand Down Expand Up @@ -65,16 +104,102 @@ parameters:
description:
short: Log GPS communication data
long: |
If this is set to 1, all GPS communication data will be published via uORB,
and written to the log file as gps_dump message.
Dump raw communication data from and to the connected receiver to the log file.
type: enum
default: 0
min: 0
max: 3
values:
0: Disabled
1: From receiver
2: To receiver
3: Both
SEP_AUTO_CONFIG:
description:
short: Toggle automatic receiver configuration
long: |
By default, the receiver is automatically configured. Sometimes it may be used for multiple purposes.
If the offered parameters aren't sufficient, this parameter can be disabled to have full control of the receiver configuration.
A good way to use this is to enable automatic configuration, let the receiver be configured, and then disable it to make manual adjustments.
type: boolean
default: true
reboot_required: true
SEP_CONST_USAGE:
description:
short: Usage of different constellations
long: |
Choice of which constellations the receiver should use for PVT computation.
If this is set to 2, the main GPS is configured to output RTCM data,
which is then logged as gps_dump and can be used for PPK.
When this is 0, the constellation usage isn't changed.
type: bitmask
bit:
0: GPS
1: GLONASS
2: Galileo
3: SBAS
4: BeiDou
default: 0
min: 0
max: 63
reboot_required: true
SEP_LOG_HZ:
description:
short: Logging frequency for the receiver
long: |
Select the frequency at which the connected receiver should log data to its internal storage.
type: enum
default: 0
min: 0
max: 10
values:
0: Disabled
1: 0.1 Hz
2: 0.2 Hz
3: 0.5 Hz
4: 1 Hz
5: 2 Hz
6: 5 Hz
7: 10 Hz
8: 20 Hz
9: 25 Hz
10: 50 Hz
reboot_required: true
SEP_LOG_LEVEL:
description:
short: Logging level for the receiver
long: |
Select the level of detail that needs to be logged by the receiver.
type: enum
default: 2
min: 0
max: 3
values:
0: Lite
1: Basic
2: Default
3: Full
reboot_required: true
SEP_LOG_FORCE:
description:
short: Whether to overwrite or add to existing logging
long: |
When the receiver is already set up to log data, this decides whether extra logged data should be added or overwrite existing data.
type: boolean
default: false
reboot_required: true
SEP_HARDW_SETUP:
description:
short: Setup and expected use of the hardware
long: |
Setup and expected use of the hardware.
- Default: Use two receivers as completely separate instances.
- Moving base: Use two receivers in a rover & moving base setup for heading.
type: enum
default: 0
min: 0
max: 2
max: 1
values:
0: Disable
1: Full communication
2: RTCM output (PPK)
0: Default
1: Moving base
reboot_required: true
Loading

0 comments on commit 8b31220

Please sign in to comment.