Skip to content

Commit

Permalink
Removed dependency on Eigen and Units libraries to better support Ard…
Browse files Browse the repository at this point in the history
…uino AVR
  • Loading branch information
flybrianfly committed Sep 29, 2022
1 parent 6af6db4 commit e35a122
Show file tree
Hide file tree
Showing 9 changed files with 61 additions and 106 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Changelog

## v6.0.0
- Removed dependency on Eigen and Units libraries to better support Arduino AVR
- Added CMake support for Teensy MMOD

## v5.1.0
- Added default constructor and a config method to configure the receiver

Expand Down
22 changes: 3 additions & 19 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@ if (DEFINED MCU)
FetchContent_Declare(
mcu_support
GIT_REPOSITORY https://github.com/bolderflight/mcu-support.git
GIT_TAG v1.0.0
GIT_TAG v1.1.0
)
FetchContent_MakeAvailable(mcu_support)
# Setting up the toolchain
set(CMAKE_TOOLCHAIN_FILE "${mcu_support_SOURCE_DIR}/cmake/cortex.cmake")
# Project information
project(Ublox
VERSION 5.1.0
VERSION 6.0.0
DESCRIPTION "uBlox UBX sensor driver"
LANGUAGES CXX
)
Expand All @@ -23,23 +23,9 @@ if (DEFINED MCU)
FetchContent_Declare(
core
GIT_REPOSITORY https://github.com/bolderflight/core.git
GIT_TAG v3.0.2
GIT_TAG v3.1.0
)
FetchContent_MakeAvailable(core)
# Fetch units
FetchContent_Declare(
units
GIT_REPOSITORY https://github.com/bolderflight/units.git
GIT_TAG v4.1.0
)
FetchContent_MakeAvailable(units)
# Fetch eigen
FetchContent_Declare(
eigen
GIT_REPOSITORY https://github.com/bolderflight/eigen.git
GIT_TAG v3.0.2
)
FetchContent_MakeAvailable(eigen)
# Add the library target
add_library(ubx
src/ubx.cpp
Expand All @@ -51,8 +37,6 @@ if (DEFINED MCU)
target_link_libraries(ubx
PUBLIC
core
units
eigen
)
# Setup include directories
target_include_directories(ubx PUBLIC
Expand Down
27 changes: 6 additions & 21 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
[![Pipeline](https://gitlab.com/bolderflight/software/ublox/badges/main/pipeline.svg)](https://gitlab.com/bolderflight/software/ublox/) [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)

![Bolder Flight Systems Logo](img/logo-words_75.png)     ![Arduino Logo](img/arduino_logo_75.png)

# Ubx
This library communicates with uBlox GNSS receivers using the UBX protocol. This library is compatible with Arduino ARM and CMake build systems.
This library communicates with uBlox GNSS receivers using the UBX protocol. This library is compatible with Arduino and CMake build systems.
* [License](LICENSE.md)
* [Changelog](CHANGELOG.md)
* [Contributing guide](CONTRIBUTING.md)
Expand All @@ -14,13 +14,13 @@ uBlox produces standard and high precision GPS receivers. These receivers featur
# Installation

## Arduino
Use the Arduino Library Manager to install this library or clone to your Arduino/libraries folder. In addition, the [Bolder Flight Systems Units library](https://github.com/bolderflight/units) and the [Bolder Flight Systems Eigen library](https://github.com/bolderflight/eigen) must be installed. This library is added as:
Use the Arduino Library Manager to install this library or clone to your Arduino/libraries folder. This library is added as:

```C++
#include "ubx.h"
```

An example Arduino executable is located in: *examples/arduino/ublox_example/ublox_example.ino*. Teensy 3.x, 4.x, and LC devices are used for testing under Arduino and this library should be compatible with other Arduino ARM devices. This library is **not** expected to work with AVR devices.
An example Arduino executable is located in: *examples/arduino/ublox_example/ublox_example.ino*. Teensy 3.x, 4.x, and LC devices are used for testing under Arduino and this library should be compatible with other Arduino devices.

## CMake
CMake is used to build this library, which is exported as a library target called *ubx*. The header is added as:
Expand All @@ -44,10 +44,11 @@ This will build the library and an example executable called *ublox_example*. Th
* MKL26Z64
* IMXRT1062_T40
* IMXRT1062_T41
* IMXRT1062_MMOD

These are known to work with the same packages used in Teensy products. Also switching packages is known to work well, as long as it's only a package change.

The example target creates an executable for communicating with the GNSS receiver using the UBX protocol. Each target also has a *_hex*, for creating the hex file to upload to the microcontroller, and an *_upload* for using the [Teensy CLI Uploader](https://www.pjrc.com/teensy/loader_cli.html) to flash the Teensy. Please note that the CMake build tooling is expected to be run under Linux or WSL, instructions for setting up your build environment can be found in our [build-tools repo](https://github.com/bolderflight/build-tools).
The example target creates an executable for communicating with the GNSS receiver using the UBX protocol. Each target also has a *_hex*, for creating the hex file to upload to the microcontroller, and an *_upload* for using the [Teensy CLI Uploader](https://www.pjrc.com/teensy/loader_cli.html) to flash the Teensy. Instructions for setting up your build environment can be found in our [build-tools repo](https://github.com/bolderflight/build-tools).

# Namespace
This library is within the namespace *bfs*.
Expand Down Expand Up @@ -146,8 +147,6 @@ The most recent valid packet is stored in the Ubx object. Data fields can be ret

**uint32_t time_acc_ns()** Estimated time accuracy, ns.

**Eigen::Vector3f ned_vel_mps()** North, East, Down (NED) velocity, m/s

**float north_vel_mps()** North velocity, m/s

**float east_vel_mps()** East velocity, m/s
Expand All @@ -156,8 +155,6 @@ The most recent valid packet is stored in the Ubx object. Data fields can be ret

**float gnd_spd_mps()** Ground speed (2D), m/s

**Eigen::Vector3f ecef_vel_mps()** ECEF velocity, m/s

**float ecef_vel_x_mps()** ECEF x velocity, m/s

**float ecef_vel_y_mps()** ECEF y velocity, m/s
Expand All @@ -174,10 +171,6 @@ The most recent valid packet is stored in the Ubx object. Data fields can be ret

**float track_acc_rad()** Estimated ground track (2D heading of motion) accuracy, rad

**Eigen::Vector3d llh_deg_m()** Latitude, longitude, and height above the WGS84 ellipsoid in degrees and meters.

**Eigen::Vector3d llh_rad_m()** Latitude, longitude, and height above the WGS84 ellipsoid in radians and meters.

**double lat_deg()** Latitude, deg

**double lat_rad()** Latitude, rad
Expand All @@ -194,8 +187,6 @@ The most recent valid packet is stored in the Ubx object. Data fields can be ret

**float vert_acc_m()** Estimated vertical position accuracy, m

**Eigen::Vector3d ecef_pos_m()** ECEF position, m

**double ecef_pos_x_m()** ECEF x position, m

**double ecef_pos_y_m()** ECEF y position, m
Expand Down Expand Up @@ -239,16 +230,12 @@ The most recent valid packet is stored in the Ubx object. Data fields can be ret

**double rel_pos_down_m()** Down component of relative position vector, m.

**Eigen::Vector3d rel_pos_ned_m()** North East Down (NED) relative position vector, m

**float rel_pos_acc_north_m()** Accuracy of relative position North component, m.

**float rel_pos_acc_east_m()** Accuracy of relative position East component, m.

**float rel_pos_acc_down_m()** Accuracy of relative position Down component, m.

**Eigen::Vector3f rel_pos_acc_ned_m()** Accuracy of the relative position, returned as a North East Down (NED) vector, m.

**double rel_pos_len_m()** Length of the relative position vector, m.

**float rel_pos_len_acc_m()** Accuracy of length of the relative position vector, m.
Expand All @@ -275,8 +262,6 @@ The most recent valid packet is stored in the Ubx object. Data fields can be ret

**double svin_ecef_pos_z_m()** Current survey-in mean position ECEF Z coordinate, m.

**Eigen::Vector3d svin_ecef_pos_m()** Current survey-in mean position ECEF vector, m.

**float svin_ecef_pos_acc_m()** Current survey-in mean position accuracy, m.

**uint32_t svin_num_obs()** Number of position observations used during survey-in.
8 changes: 0 additions & 8 deletions keywords.txt
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,10 @@ gps_tow_s KEYWORD2
gps_week KEYWORD2
leap_s KEYWORD2
time_acc_ns KEYWORD2
ned_vel_mps KEYWORD2
north_vel_mps KEYWORD2
east_vel_mps KEYWORD2
down_vel_mps KEYWORD2
gnd_spd_mps KEYWORD2
ecef_vel_mps KEYWORD2
ecef_vel_x_mps KEYWORD2
ecef_vel_y_mps KEYWORD2
ecef_vel_z_mps KEYWORD2
Expand All @@ -36,8 +34,6 @@ track_deg KEYWORD2
track_rad KEYWORD2
track_acc_deg KEYWORD2
track_acc_rad KEYWORD2
llh_deg_m KEYWORD2
llh_rad_m KEYWORD2
lat_deg KEYWORD2
lat_rad KEYWORD2
lon_deg KEYWORD2
Expand All @@ -46,7 +42,6 @@ alt_wgs84_m KEYWORD2
alt_msl_m KEYWORD2
horz_acc_m KEYWORD2
vert_acc_m KEYWORD2
ecef_pos_m KEYWORD2
ecef_pos_x_m KEYWORD2
ecef_pos_y_m KEYWORD2
ecef_pos_z_m KEYWORD2
Expand All @@ -67,11 +62,9 @@ rel_pos_normalized KEYWORD2
rel_pos_north_m KEYWORD2
rel_pos_east_m KEYWORD2
rel_pos_down_m KEYWORD2
rel_pos_ned_m KEYWORD2
rel_pos_acc_north_m KEYWORD2
rel_pos_acc_east_m KEYWORD2
rel_pos_acc_down_m KEYWORD2
rel_pos_acc_ned_m KEYWORD2
rel_pos_len_m KEYWORD2
rel_pos_len_acc_m KEYWORD2
rel_pos_heading_deg KEYWORD2
Expand All @@ -84,6 +77,5 @@ svin_dur_s KEYWORD2
svin_ecef_pos_x_m KEYWORD2
svin_ecef_pos_y_m KEYWORD2
svin_ecef_pos_z_m KEYWORD2
svin_ecef_pos_m KEYWORD2
svin_ecef_pos_acc_m KEYWORD2
svin_num_obs KEYWORD2
2 changes: 1 addition & 1 deletion library.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name=Bolder Flight Systems UBLOX
version=5.1.0
version=6.0.0
author=Brian Taylor <[email protected]>
maintainer=Brian Taylor <[email protected]>
sentence=Library for communicating with uBlox GPS receivers.
Expand Down
11 changes: 5 additions & 6 deletions src/ubx.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,11 @@
#if defined(ARDUINO)
#include <Arduino.h>
#else
#include "core/core.h"
#endif
#include <cstddef>
#include <cstdint>
#include "eigen.h" // NOLINT
#include "ubx.h" // NOLINT
#include "core/core.h"
#endif
#include "ubx.h"
#include "ubx_defs.h" // NOLINT
#include "ubx_nav.h" // NOLINT

Expand All @@ -45,11 +44,11 @@ bool Ubx::Begin(int32_t baud) {
bus_->end();
bus_->begin(baud);
bus_->flush();
t_ms_ = 0;
while (t_ms_ < COMM_TIMEOUT_MS_)
while (comm_timeout_count_ < COMM_TIMEOUT_TRIES_)
if (ParseMsg()) {
return true;
}
delay(COMM_TIMEOUT_DELAY_MS_);
return false;
}
bool Ubx::Read() {
Expand Down
Loading

0 comments on commit e35a122

Please sign in to comment.