Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Inertia navigation and landmarks tracking #907

Open
wants to merge 13 commits into
base: main
Choose a base branch
from

Conversation

A-acuto
Copy link
Contributor

@A-acuto A-acuto commented Dec 12, 2023

In this PR we present a set of measurement models regarding inertia navigation, in particular the measurement models from accelerometer and gyroscope on board of sensors. To use these measurement models a set of navigation functions have been added (including tests).
Summarising this PR consists in:

  1. Navigation functions and Euler angles calculations;
  2. Accelerometer measurement model
  3. Gyroscope Measurement model
  4. Azimuth-Elevation and Azimuth-Elevation-Range measurement model with fixed targets (for navigation calibration)
  5. an example of tracking using these measurement models.
  6. set of tests for the functions and measurement models.

…asing how does it work. Added tests and checks to the functions, measurements models.
jswright-dstl and others added 5 commits December 13, 2023 17:30
…en UKF, EKF and Particle filters. Updated the measurement model to work with EKF and PF. Fixed a string that was causing the test to fail.
…en UKF, EKF and Particle filters. Updated the measurement model to work with EKF and PF. Fixed a string that was causing the test to fail.
@A-acuto
Copy link
Contributor Author

A-acuto commented Dec 14, 2023

In the comparison example I was not able to use the metric manager (in particular the SIAP metric) because the track associator was trying to iterate the GroundTruthState (doing something like next(state) from the GroundTruthPath) and it was failing. Therefore I used a less elegant solution to show the positional accuracy.

Here is a gist that shows the problem:
https://gist.github.com/A-acuto/3c182d049e4df181e35c2a82307544fc

Copy link
Member

@sdhiscocks sdhiscocks left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Had an initial look at the code. Main points: being consistent with radians, rather than degrees; and to double check if a different angle convention is being used; a few places where functions could be vectorised (included some suggestions but may not be best approach).

stonesoup/functions/__init__.py Outdated Show resolved Hide resolved
stonesoup/functions/navigation.py Outdated Show resolved Hide resolved
stonesoup/functions/navigation.py Outdated Show resolved Hide resolved
stonesoup/functions/navigation.py Outdated Show resolved Hide resolved
stonesoup/functions/navigation.py Outdated Show resolved Hide resolved
stonesoup/functions/navigation.py Outdated Show resolved Hide resolved
stonesoup/functions/navigation.py Outdated Show resolved Hide resolved
stonesoup/functions/navigation.py Outdated Show resolved Hide resolved
stonesoup/functions/navigation.py Outdated Show resolved Hide resolved
stonesoup/models/measurement/nonlinear.py Outdated Show resolved Hide resolved
@A-acuto
Copy link
Contributor Author

A-acuto commented Jan 11, 2024

@sdhiscocks thanks for the comments and suggestions, I'll apply them and double check the degree-radians transformations to keep the code uniform. As well, I'll check if PyMap3D does contain functions needed.

…niformed the angles to radians, removed functions already present in the code, grammar checks and documentation
@A-acuto
Copy link
Contributor Author

A-acuto commented Jan 31, 2024

In the last commits I answered the comments provided, in details:

  • removed functions already present (e.g. angle_wrap -> mod_bearing)
  • made extensive use of PyMap3D for distances and functions
  • vectorisation of functions
  • switch from degrees to radians and alignment with stone soup rotation order
  • grammar improvements and checks in the examples

The only point I am not sure about, but as presented works fine, is the use of function Build_rotation_matrix which assumes angles being 1-dimensional, which should be fine when dealing with Kalman filter tracking but not for Particle filter. However allowing it to be multi-dimensional (arrays of (3, N) dimension) is messing up the tracking with the particle filter.

Copy link
Contributor

@csherman-dstl csherman-dstl left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've left some comments generally on the wording in the examples and some PEP styling on function names. All functions and function variables in init.py and navigation.py should be named in snake_case.

-----------
target_speed: float
Speed of the sensor;
target_tadius: float
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
target_tadius: float
target_radius: float

start_time: datetime,
start of the simulation;
number_of_timesteps: np.array
simulation lenght
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
simulation lenght
simulation length

# accelerometer and gyroscope, with fixed target locations, also refereed as landmarks.
# In this example, we simulate a three dimensional sensor, moving in 3D cartesian space,
# we have the measurements from on-board instruments that evaluates the Euler angles, whose describe the
# sensor rotations and orientation during the flight, as well as the the 3D forces acting on the sensor.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
# sensor rotations and orientation during the flight, as well as the the 3D forces acting on the sensor.
# sensor rotations and orientation during the flight, as well as the 3D forces acting on the sensor.

# In this example, we present how to perform the tracking task using an inertia
# navigation measurement model making use of instruments mounted on the sensor.
# This example is relevant for tracking sensors in environments where GPS tracking is not
# available and we integrate the information obtained from instruments on board, as the
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
# available and we integrate the information obtained from instruments on board, as the
# available and we integrate the information obtained from instruments on board, the

# model for the z-coordinate, since the sensor is moving on a fixed plane at 1 km above the surface.
# At this stage we can start collecting both the groundtruths and # the measurement using a composite
# measurement model merging the measurements from the :class:`~.AccelerometerMeasurementModel`,
# the :class:`~.GyroscopeMeasurementModel` and the landmarks, using an
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
# the :class:`~.GyroscopeMeasurementModel` and the landmarks, using an
# the :class:`~.GyroscopeMeasurementModel` and the landmarks, using a

# the :class:`~.GyroscopeMeasurementModel` and the landmarks, using an
# :class:`~.CartesianAzimuthElevationMeasurementModel`.
# This measurement model combines the specific forces measured by the accelerometer instrument
# and the angular rotation from the inertia movements of the target. The landmarks helps reducing the
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
# and the angular rotation from the inertia movements of the target. The landmarks helps reducing the
# and the angular rotation from the inertia movements of the target. The landmarks help to reduce the

return (latitude, longitude, altitude)


def localSphere2GCS(xEast, yNorth, zUp, origin):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
def localSphere2GCS(xEast, yNorth, zUp, origin):
def local_sphere2GCS(x_east, y_north, z_up, origin):

According to PEP-8 function and function variables should be in snake case.

from . import localSphere2GCS, build_rotation_matrix


def earthSpeedFlatSq(dx, dy):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
def earthSpeedFlatSq(dx, dy):
def earth_speed_flat_sq(dx, dy):

Snake case should be used for function names. This is the case for all functions in this file.

"""

# mapping
position_mapping = (0, 3, 6)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should these mappings be arguments for generality?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants