Skip to content

Commit

Permalink
Update Changelog and fix formatting in some docstrings.
Browse files Browse the repository at this point in the history
  • Loading branch information
Mayitzin committed Sep 29, 2021
1 parent ace61cb commit 4353a99
Show file tree
Hide file tree
Showing 4 changed files with 85 additions and 16 deletions.
69 changes: 66 additions & 3 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,72 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [0.3.1] - 2021-09-29
### Added
- Error raise if geomagnetic field is invalid in class `EKF`.
- New method `Omega` in class `AQUA` to simplify the product between angular rate and quaternion.
- New method `rotate_by` in class `QuaternionArray`.
- More Acronyms in page `Nomeclature` of documentation.
- Individual pages for each method and attribute of classes `Quaternion` and `DCM` into documentation.
- Merge pull request of basic automation tests.

### Changed
- Fix undefined matrix `R` in method `update` of class `EKF`.
- Fix shape of converted points in function `ned2enu`.
- Fix parameters in function `rec2geo` of submodule `frames`.
- Fix method `from_quaternion` of class `DCM`.
- Fix Munich height (in km) in global constants.
- Improve detection of empty arrays when building `TRIAD` object.
- Improve description of estimator `AQUA` in its docstring.
- Improve imports in submodules `frames` and `dcm`.
- Improve style and descriptions in docstrings of functions in submodule `orientation`.
- Method `init_q` is now synonym of the more convenient method `estimate` in class `AQUA`.
- Parameter `as_quaternion` in method `estimate` of class `TRIAD` renamed to `representation`, and its value is now of type `str`.
- Versioning is defined using f-strings.

### Removed
- Redundant normalization of magnetic measurement vector in class `FQA`.

## [0.3.0] - 2021-02-03
### Added
- World Magnetic Model as class `WMM`.
- World Geodetic System as class `WGS`.
- Geodetic and planetary constants.
- New class `DCM` to represent Direction Cosine Matrices.
- Attitude Estimator `EKF`.
- Attitude Estimator `TRIAD`.
- Attitude Estimator `Davenport`.
- Attitude Estimator `QUEST`.
- Attitude Estimator `SAAM`.
- Attitude Estimator `OLEQ`.
- Attitude Estimator `ROLEQ`.
- Implementation of modes `newton`, `eig` and `symbolic` in estimator `FLAE`.
- New function `ecompass` to estimate Orientation from an observation of an accelerometer and a magnetometer.
- New method `row_reduction` in estimator `FLAE`.
- New methods `to_angles`, `is_pure`, `is_real`, `is_versor`, and `is_identity` in class `QuaternionArray`.
- New properties `logarithm` and `log` in class `Quaternion`.
- New parameter `versor` defaulting to `True` in class `Quaternion` to initialize quaternions as versors.
- New frame transformations `ned2enu`, `enu2ned`, `ecef2enu`, `enu2ecef`, `ll2ecef`, and `ecef2llf`.
- Requirements file.
- Manifest file.
- Documentation with Sphinx.
- Type hints.

### Changed
- Fix `AQUA`.
- Fix missing imports in several submodules.
- Fix versioning that prevented install from a fresh setup.
- `Tilt` can perform vectorized estimations over 2D arrays.
- `QuaternionArray` is now subclassed from a `numpy.array`.
- Simplify implementation of class `Complementary`.
- Create copies of quaternions and normalize them when given in `metrics` functions.
- Complete attitude estimator `FAMC`.
- Complete docstrings of all functions, methods and classes.
- Improve examples and information in `README`.

### Removed
- Submodules `plot` and `io` to remove dependencies on `scipy` and `matplotlib`.

## [0.2.2-dev1] - 2020-02-06
### Added
- Support for other characters as separators in function `load` of submodule `io`.
Expand All @@ -31,9 +97,6 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Class `QuaternionArray` to handle several quaternions at once.
- Add methods `log()`, `exp()`, `inv()`, `to_array()` and `to_list()` to class `Quaternion`.

### Changed
- Fix and/or improve

## [0.2.0] - 2019-12-27
### Added
- Class `Quaternion` to handle quaternion operations.
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ array([ 0.19537239, 0.17826049, -0.87872408, -0.39736232])

One of the biggest improvements in this version is the addition of many new attitude estimation algorithms.

All estimators are refactored to be consistent to the original articles describing them. They have in-code references to the original equations, so that you can follow the original articles along with the code.
All estimators are refactored to be consistent with the corresponding articles describing them. They have in-code references to the equations, so that you can follow the original articles along with the code.

Implemented attitude estimators are:

Expand All @@ -209,7 +209,7 @@ Implemented attitude estimators are:
| Tilt | NO | YES | Optional |
| TRIAD | NO | YES | YES |

More Estimators are still a *Work In Progress*, or *planned* to be added in the future.
More Estimators are still a _Work In Progress_, or _planned_ to be added in the future.

| Algorithm | Gyroscope | Accelerometer | Magnetometer | Status |
|-----------|:---------:|:-------------:|:------------:|:-------:|
Expand Down
2 changes: 0 additions & 2 deletions ahrs/common/quaternion.py
Original file line number Diff line number Diff line change
Expand Up @@ -387,8 +387,6 @@ def slerp(q0: np.ndarray, q1: np.ndarray, t_array: np.ndarray, threshold: float

class Quaternion(np.ndarray):
"""
Quaternion.
Representation of a quaternion. It can be built with 3- or 4-dimensional
vectors. The quaternion object is always normalized to represent rotations
in 3D space, also known as a **versor**.
Expand Down
26 changes: 17 additions & 9 deletions ahrs/filters/madgwick.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
Orientation from angular rate
-----------------------------
The orientation of the Earth frame realtive to the sensor frame
The orientation of the Earth frame relative to the sensor frame
:math:`\,\\mathbf{q}_{\\omega, t}=\\begin{bmatrix}q_w & q_x & q_y & q_z\\end{bmatrix}`
at time :math:`t` can be computed by numerically integrating the quaternion
derivative :math:`\\dot{\\mathbf{q}}_t=\\frac{1}{2}\\mathbf{q}_{t-1}\\mathbf{\\omega}_t` as:
Expand All @@ -54,8 +54,8 @@
is calculated from angular rates.
A more detailed explanation of the orientation estimation solely based on
angular rate can found in the documentation of the `AngularRate <./angular.html>`_
estimator.
angular rate can be found in the documentation of the `AngularRate
<./angular.html>`_ estimator.
Orientation as solution of Gradient Descent
-------------------------------------------
Expand All @@ -68,7 +68,7 @@
its corresponding *measured* direction in the sensor frame,
:math:`^S\\mathbf{s}=\\begin{bmatrix}0 & s_x & s_y & s_z\\end{bmatrix}`.
Thus, the **objective function** is:
Thus, the `objective function <https://en.wikipedia.org/wiki/Loss_function>` is:
.. math::
\\begin{array}{rcl}
Expand Down Expand Up @@ -363,7 +363,7 @@
References
----------
.. [Madgwick] Sebastian Madgwick. An efficient orientation filter for inertial
.. [Madgwick] Sebastian Madgwick. An efficient orientation filter for inertial
and inertial/magnetic sensor arrays. April 30, 2010.
http://www.x-io.co.uk/open-source-imu-and-ahrs-algorithms/
Expand All @@ -373,7 +373,8 @@
from ..common.orientation import q_prod, q_conj, acc2q, am2q

class Madgwick:
"""Madgwick's Gradient Descent Orientation Filter
"""
Madgwick's Gradient Descent Orientation Filter
If ``acc`` and ``gyr`` are given as parameters, the orientations will be
immediately computed with method ``updateIMU``.
Expand Down Expand Up @@ -426,8 +427,12 @@ class Madgwick:
Examples
--------
Assuming we have 3-axis sensor data in N-by-3 arrays, we can simply give
these samples to their corresponding type. The Madgwick algorithm can work
solely with gyroscope and accelerometer samples.
these samples to their corresponding type.
**IMU Array**
The Madgwick algorithm can work solely with gyroscope and accelerometer
samples.
The easiest way is to directly give the full array of samples to their
matching parameters.
Expand All @@ -448,6 +453,8 @@ class Madgwick:
>>> for t in range(1, num_samples):
... Q[t] = madgwick.updateIMU(Q[t-1], gyr=gyro_data[t], acc=acc_data[t])
**MARG Array**
Further on, we can also use magnetometer data.
>>> madgwick = Madgwick(gyr=gyro_data, acc=acc_data, mag=mag_data) # Using MARG
Expand Down Expand Up @@ -506,7 +513,8 @@ def __init__(self, gyr: np.ndarray = None, acc: np.ndarray = None, mag: np.ndarr
self.Q = self._compute_all()

def _compute_all(self) -> np.ndarray:
"""Estimate the quaternions given all data.
"""
Estimate the quaternions given all data.
Attributes ``gyr`` and ``acc`` must contain data. If ``mag`` contains
data, the updateMARG() method is used.
Expand Down

0 comments on commit 4353a99

Please sign in to comment.