Added several more posts

This commit is contained in:
Jeremy Karst 2025-04-04 17:58:41 -04:00
parent 2e597f5b8f
commit 360a33cd77
29 changed files with 328 additions and 15 deletions

View file

@ -89,7 +89,9 @@ header button[id^="search-button"] {
border: 1px solid rgba(25, 25, 35, 0.35);
transition: all 0.3s ease;
backdrop-filter: blur(4px);
animation: backdropShift 10s linear infinite;
/* We use steps here to limit framerate to reduce CPU usage displaying the animation*/
/* Because it is a slowly changing background, a low framerate does not impact apparent smoothness of the animation */
animation: backdropShift 20s forwards steps(200) infinite;
-webkit-backdrop-filter: blur(8px);
filter: saturate(0.9) brightness(0.9);
}

View file

@ -21,9 +21,9 @@ fingerprintAlgorithm = "sha256"
[header]
layout = "basic" # valid options: basic, hamburger, hybrid, custom
header.logo = "img/karsttech_logo_cube.png"
logo = "img/karsttech_logo_horiz.png"
# logoDark = "img/karsttech_logo_cube.png"
showTitle = true
showTitle = false
[footer]
showCopyright = true

View file

@ -340,14 +340,25 @@ data: {
## KaTex / LaTex
Inline:
```markdown
{{</* katex */>}} \\(f(a,b,c) = (a^2+b^2+c^2)^3\\)
```
{{< katex >}} \\(f(a,b,c) = (a^2+b^2+c^2)^3\\)
Block:
```markdown
{{</* katex */>}}
\\(f(a,b,c) = (a^2+b^2+c^2)^3\\)
$$
f(a,b,c) = (a^2+b^2+c^2)^3
$$
```
{{< katex >}}
\\(f(a,b,c) = (a^2+b^2+c^2)^3\\)
$$
f(a,b,c) = (a^2+b^2+c^2)^3
$$
## Lead
```markdown

Binary file not shown.

After

(image error) Size: 111 KiB

Binary file not shown.

After

(image error) Size: 58 KiB

Binary file not shown.

After

(image error) Size: 129 KiB

View file

@ -0,0 +1,135 @@
+++
title = 'USM Magnetics - Machine Learning'
date = 2025-04-03T16:00:00-05:00
draft = false
categories = ['USM', 'magnetics']
tags = ['data science', 'KarstTech', 'UUV', 'modeling', 'machine learning', 'AI']
+++
{{< katex >}}
# Machine Learning for Target Classification and Localization
I wanted to share some exciting progress from our recent efforts to detect, classify, and localize magnetic targets underwater. So today we're diving deeper into machine learning approaches.
## Magnetic Modeling Foundation
We've established three distinct magnetic modeling techniques, each with different advantages:
1. **Simple Dipole Model** - This is the most basic type of magnetic model, and so also the fastest to calculate, making it ideal for generating billions of examples for initial AI training. We rely on magpylib to calculate the magnetic field near a dipole source as it provides a simple API for the underlying numpy array calculations. The parameters of the dipole are provided based on an expected range of target properties. The equation for the magnetic field of a dipole is given by:
$$
\vec{B}(\vec{r}) = \frac{\mu_0}{4\pi} \left[ \frac{3\vec{r}(\vec{m} \cdot \vec{r})}{r^5} - \frac{\vec{m}}{r^3} \right]
$$
- \\( \vec{B} \\) is the magnetic field vector
- \\( \vec{r} \\) is the position vector of the field point
- \\( \vec{m} \\) is the magnetic dipole moment vector
- \\( \mu_0 \\) is the permeability of free space
- \\( \pi \\) is the mathematical constant pi
![Magnetic Field of a Dipole](magnet_fieldlines_dipoles-001-small.webp "Dipole Field")
2. **Ellipsoid Modeling** - Developed in partnership with Colorado School of Mines, this technique efficiently models triaxial ellipsoids with full support for magnetic induction and self-demagnetization effects. These models are perfect for AI training since they can generate realistic data on-the-fly. Ellipsoids are the most complex geometry for which we have a closed-form solution for the magnetic field including self-demagnetization, and so it is the most complex type of target for which we can generate individual sensor samples without needing to simulate the entire target and environment. More complex geometries can be estimated by using multiple ellipsoids and adding or subtracting them from each other. This method is imperfect because the induction and demagnetization effects between ellipsoids are not taken into account.
The mathematical model for these ellipsoids is too complex to describe here, but our techniques are based on this paper: [Ellipsoids (v1.0): 3-D magnetic modelling of ellipsoidal bodies](https://gmd.copernicus.org/articles/10/3591/2017/)
![Magnetic Field of an Ellipsoid](Ellipsoid-Bx-Contour-3D.webp "Ellipsoid Field")
3. **COMSOL Multiphysics Simulation** - Our most accurate modeling technique that fully supports magnetic induction and self-demagnetization with arbitrary target geometries. These models have been validated against real-world test data, but are computationally expensive to run.
![Magnetic Field of Cylinder](comsol-model.webp "Cylinder Field")
## ML Progress
{{< mermaid >}}
flowchart TD
subgraph "Example CNN Architecture"
A["Position Input [N, 3]"] --> C
B["Magnetometer Input [N, 3]"] --> C
C["Conv2D: 3→64"] --> D
D["Conv2D: 64→128"] --> G
E["Mag DC Offsets [3]"] --> I
F["Position / Mag Scaling Factors [2]"] --> I
G["Conv2D: 128→256"] --> H
H["Global AvgPool"] --> K
I["Linear: 5→32"] --> J
J["Linear: 32→32"] --> K
K["Feature Concat"] --> L
L["Dense Layers"] --> M
M["Output Layer"]
end
{{< /mermaid >}}
Building on this foundation for magnetic target modeling, we have created a series of machine learning models which have proven able to predict target location, orientation, and magnetic strength with impressive accuracy despite their low parameter count.
### Beginnings
Our initial models were scattered attempts to see which general types of neural networks would work best for this task. LSTM, RNN, and CNN models were all tried, and none performed very well for various reasons. Eventually a hybrid approach was found to preprocess the magnetic data to normalize it, and then use a CNN to learn the features within the normalized data. The extracted scaling factors and DC offsets were then used to feed into the deeper layers of the network to give the model information about field strength. This was primarily done to combat a vanishing gradient problem that occurs when target strengths vary by many orders of magnitude, both due to the variance in expected target strengths, and also due to the fact that the magnetic field strength of a dipole falls off as the cube of the distance from the target, and our distances to target vary significantly.
These hybrid CNN models were explored using parameter sweeps to optimize their geometry, and the results for target localization were nearly perfect to within the expected error introduced as noise in the input data. Target orientation and magnetic strength were also predicted, but with poor accuracy.
### Improvements
Several methods were explored to improve the accuracy of the model, including:
- Changing the loss functions to prevent vanishing gradients followed by NaN propagation.
- Attention mechanisms within the model were explored, but these also showed no improvement.
- Changing the orientation representation within the training data / model output to be more consistent and easier to learn.
- Euler angles were used at first, but these had many problems.
- Quaternions were tried in an attempt to address uniformity and gimbal lock issues, but with little to no improvement.
- Gram-Schmidt orthogonalization was used to ensure that the orientation vectors were orthogonal, and that the gradient was smooth for all changes in angle. This was expected to solve the problem, but showed minimal advantage over the other methods.
- The most successful method found was to encode the orientation and the magnetic strength into a single 3-vector, rather than encoding them separately. This representation is presumed to be successful because the vector representation of magnitude allows for more linear relationships between the model output and the input, which are more easily modeled and learned by the network.
### 3D Convolutional Layers
In addition to the loss function changes and orientation representation iterations, one of the most significant improvements was switching from 2D to 3D convolutional layers in our neural networks. This allows the model to better understand the relationships between sensor positions and vector field components, dramatically improving performance per parameter count. The three dimensions of the input data in question are Sample Number, Sensor Position (X,Y,Z), and Vector Field Component (X,Y,Z).
Though Loss in this context is somewhat loosely defined without looking at the loss equations, the performance of the model was improved by several times over, corresponding to a reduction in loss by a factor of 1/2 or better for equivalent parameter counts and training times. The blue dot in the plot below shows the performance of the best model which includes all of the improvements mentioned above, and red dots show other configurations which were explored, with the far upper right two dots showing the initial models. Note that the initial and final model architectures are not directly comparable due to changes to their loss functions, though it is expected that this would make the improvements even more pronounced.
![Hyperparameter Search](Hyperparam-search.png "Hyperparameter Search")
## Model Performance Stats
The current best model seems to be performing quite well!
- 99.72% of predictions are within 1m or 20% of actual target position
- 97.24% of predictions are within 0.3m or 10% of actual target position
- The model works for targets between 3-15m from closest approach
- ~4.5M parameters, which can easily run on low power hardware onboard the UUV
- Inference time is extremely fast (0.02ms on an RTX 4090), meaning it should run well under one second on the actual UUV hardware
The cases where the model gives poor predictions seem to be primarily when the simulated target is very weak and the point of closest approach is at a large distance, which is expected. No attempt is made while creating input data to validate that a given target is detectable under the noise floor, and so this issue is expected.
![Model Performance](model-output-featured.png "Model Performance For A Single Example")
The visualization above shows the chosen model target prediction capability for one example in the validation data set. The model never saw this data point during training, and its location prediction is within approximately 0.35m from a closest approach of 9.61m. The target orientation prediction is accurate to within 1.335 degrees despite the magnetic moment from which it is derived containing a high ~30% error. This high magnetic moment error is in part due to the added noise combined with the high sensitivity of the predicted moment magnitude to errors due to the inverse cubed falloff nature of magnetic fields. Prediction accuracy, and especially magnetic moment prediction accuracy improves at closer ranges and larger magnitude targets.
## Parametric Inversion Method
In addition to machine learning, we developed a first principles approach using parametric inversion. This technique:
- Constructs a mathematical model of the relationship between magnetic sources and observable fields
- Uses optimization to solve the inverse problem and recover target properties
- Provides well-defined behavior that can serve as a benchmark for ML solutions
- Is limited only by input data quality and can provide high precision with good measurements
While not as noise-tolerant as our ML approach, the parametric inversion method offers reliable, physics-based results without the risk of unexpected behavior in novel conditions. I might write more about this in a future post since it deserves a more detailed explanation.
## Next Steps
For our next phase, we'll be focusing on:
- Expanding our ML models to handle complex magnetic signatures from multiple targets
- Integrating formal classification frameworks with our extracted parameters
- Testing with real-world data from our UUV platform
- Optimizing for embedded systems with limited hardware resources
The ultimate goal remains enhancing UUV capabilities for detecting underwater objects, and using magnetic sensing to complement traditional navigation methods.
I'm excited to see how these models perform in upcoming open water tests with real UUVs in the near future!

Binary file not shown.

After

(image error) Size: 146 KiB

Binary file not shown.

After

(image error) Size: 136 KiB

Binary file not shown.

After

(image error) Size: 34 KiB

View file

@ -0,0 +1,58 @@
+++
title = 'USM Magnetics - Magnetic Modeling'
date = 2025-03-31T16:00:00-05:00
draft = false
categories = ['USM', 'magnetics']
tags = ['data science', 'KarstTech', 'UUV', 'modeling', 'machine learning', 'COMSOL']
+++
# Potential Fields Modeling to Support Machine Learning Applications in Maritime Environments
The summary below is from a published paper that I co-authored with my colleagues at USM Magnetics. If you would rather read the full paper, you can find it [here](https://www.comsol.com/paper/potential-fields-modeling-to-support-machine-learning-applications-in-maritime-environments-135922).
The primary goal of our magnetic models in this paper is to support detection classification and localization of magnetically active targets using an unmanned underwater vehicle. In addition to helping classify targets, this sensing is used to augment navigation alongside other more traditional sensors. Our team has developed a comprehensive framework using COMSOL Multiphysics as well as other tools, to model gravity and magnetic fields underwater in support of these goals.
## The Challenge We Addressed
We recognized a critical gap in our ability to detect underwater objects like unexploded ordnance, shipwrecks, and geological features. The Earth's constantly changing magnetic field makes predictions based solely on field observations unreliable, and large portions of the earth aren't magnetically mapped at sufficient resolution for anomaly detection. In addition to the lack of data, collection of local geomagnetic anomalies is traditionally done using expensive survey vessels, and adding this sensing capability to low cost UUVs may allow small swarms of autonomous vehicles to map larger areas far more quickly and cheaply.
## Our Simulation Environment
We chose COMSOL Multiphysics 6.2 for our sandbox environment, specifically utilizing the Magnetic Fields, No Currents interface. This allowed us to solve the Poisson equation for magnetostatics and create detailed simulations of how various targets would influence the surrounding magnetic field. We focused on how the interaction between ferromagnetic targets and the Earth's magnetic field would be affected by the target's size, shape, and magnetic permeability, and how that field would be detected by a vehicle equipped with a vector magnetometer.
We modeled different targets—thin, hollow cylinders ("isopipes") of 12 or 24 inches in length—with varying magnetic permeabilities (50, 100, or 200). These targets were not only modeled within our COMSOL simulation environment, but also using other tools including MagPyLib, as well as a magnetic induction ellipsoid model co-developed with the Colorado School of Mines. All of these models were tested against real world data collected in a detailed field experiment.
![Isopipe COMSOL Model](Simplified-COMSOL-Model.jpg "Isopipe COMSOL Model")
## Validation Through Field Tests
To ensure our models were accurate, we conducted field experiments with a low magnetic test platform. This platform had no propulsion to ensure that the only magnetic field influence was from the targets nearby. We drew this platform between two points across water (about 70 meters) using a winch system to maintain a consistent linear path. We placed a variety of known targets underneath this path and collected data using an array of high precision vector magnetometers, with RTK-enhanced GPS to reference position.
![Field Test Sensor Platform](sensor-platform.jpg "Field Test Sensor Platform")
### Sensor Fusion
We used sensor fusion with the IMU, magnetic, and GPS data from the test platform to create a georeferenced magnetic field for our sensor data. The georeferenced data allows combining collections from multiple test passes to create a more complete picture of the magnetic field in the area.
![Sensor Fusion](T7-Magnet-Orientation-Correction-3D.gif "Sensor Fusion")
The sensor fusion techniques that we developed for this project are described in more detail in [this post](/professional-projects/usm-magnetics-sensor-fusion/).
## Agreement with Simulations
![Cylindrical Magnet Target (Left) and Isopipe Target (Right)](sim-vs-test-examples-sidebyside.jpg "Cylindrical Magnet Target (Left) | Isopipe Target (Right)")
For all of the targets tested, the simulated and measured data showed good agreement. A formal study of error sources is briefly mentioned in the paper, but such a thing is difficult to do well since the sources of error are numerous and complex. As an example, the magnetic permeability of the target is a huge factor in the amount of magnetic field anomaly created by induced magnetization, and the difference in permeability can be hundreds of times with only asmall difference in steel alloy composition.
## Machine Learning for Target Classification
With simulations that were refined based on field test data, we proceeded to generate simulated data sets for use in training machine learning models for target classification and localization. Several methods were tested and mentioned in the paper, but since the work is ongoing and rapidly progressing, I will save more details for a future post!
## Future Directions
There's still much work ahead. We're particularly interested in:
- Testing observational data as validation for ML models trained on simulations, including data collected from open water tests with a real UUV.
- Generating predictive models for field operations to estimate distance to target and target type
- Addressing edge computing challenges for deploying these models on UUVs with limited resources
- Developing robust data pipelines for the high-volume sensor data these applications generate, including processing real world data for fine tuning models.

Binary file not shown.

After

(image error) Size: 77 KiB

Binary file not shown.

After

(image error) Size: 4.8 MiB

View file

@ -0,0 +1,107 @@
+++
title = 'USM Magnetics - Magnetic Parametric Inversion'
date = 2025-04-04T14:00:00-05:00
draft = false
categories = ['USM', 'magnetics']
tags = ['data science', 'KarstTech', 'modeling']
+++
{{< katex >}}
# Magnetic Dipole Localization: Methods for Parametric Inversion
In the previously discussed ML based methods for magnetic target localization, we trained and tested models from simulated data. In the case that we are working with near perfect data, the problem that the ML models approximate is the same as the method of parametric inversion. If well trained, the hope is that the ML models will perform better than parametric inversion in the real world, but developing the inversion method provides a good baseline for comparison, both for computational complexity and for accuracy.
## So what is Parametric Inversion?
Parametric inversion is a method for estimating the position and magnetic moment of a magnetic dipole from the field it creates. It is a physics-based method that is relatively simple to understand and implement, and is therefore a good baseline for comparison to the ML based methods. In essence, we set up a system of equations that describes the magnetic field at a given set of measured points in space due to the dipole and it's properties, then we solve this overdetermined system of equations using optimization.
The magnetic field of a dipole at position \\( \vec{r} \\) relative to the dipole is given by:
$$
\vec{B}(\vec{r}) = \frac{\mu_0}{4\pi} \frac{3(\vec{m} \cdot \hat{r})\hat{r} - \vec{m}}{|\vec{r}|^3}
$$
Expanding this out in cartesian coordinates, we get:
$$
% Expanded form with vector components
\begin{pmatrix} B_x \\ B_y \\ B_z \end{pmatrix} = \frac{\mu_0}{4\pi} \frac{1}{r^3} \left[ 3 \frac{(m_x r_x + m_y r_y + m_z r_z)}{r^2} \begin{pmatrix} r_x \\ r_y \\ r_z \end{pmatrix} - \begin{pmatrix} m_x \\ m_y \\ m_z \end{pmatrix} \right]
$$
Where:
- \\( (x_0, y_0, z_0) \\) represents the coordinates of the dipole's position
- \\( (x_i, y_i, z_i) \\) represents the coordinates of the $i$-th measurement point
- \\( (r_x, r_y, r_z) \\) or \\( \vec{r}_i \\) represents the vector from the dipole to the measurement point
- \\( (m_x, m_y, m_z) \\) are the components of the dipole moment vector
- \\( (B_{x}, B_{y}, B_{z}) \\) or \\( \vec{B} \\) are the measured field components at a point
- \\( \mu_0 \\) is the magnetic permeability of free space
Once we set up the system of equations, we can optimize for the least squares solution for the dipole moment and position vectors \\( \vec{m} \\) and \\( \vec{r} \\). In my case, I used the `scipy.optimize.least_squares` function to do this, but this may soon be replaced by a custom simulated annealing approach. One other place where this may be improved is weighting the uncertainty in measurements according to the distance from the dipole, as the field strength is inversely proportional to the cube of the distance, and lower strength measurements are more prone to error from noise.
## Data Preparation
Before we can use a solver for the parametric inversion, it can be useful to estimate the dipole properties using some other methods. This can help ensure the optimizer converges to the correct solution, and does not get stuck in a local minimum, or use more than the necessary computational resources.
### Background Field Estimation
In our simulations, we have more than just the field from the dipole to contend with. We have the background field from the Earth, and we have other fields from noise sources like the UUV itself. The approach begins by distinguishing the dipole field from background fields (like Earth's magnetic field). It identifies regions where field variations are minimal and consistent, suggesting background dominance rather than dipole influence. This is done by:
1. Analyzing field derivatives to find areas of low variation
2. Evaluating local field consistency within sliding windows
3. Combining these metrics to identify the most reliable background-dominated regions
### Position Estimation
The dipole's position is estimated through analysis of the field pattern along the measurement line. The method uses several key insights:
1. The maximum field strength typically occurs at the point nearest to the dipole
2. The Full Width at Half Maximum (FWHM) of the field magnitude profile relates to the perpendicular distance to the dipole (roughly FWHM ≈ 2h, where h is the distance)
3. This initial estimate is then refined using pattern-matching optimization
The physics behind this relies on the rapid decay of dipole fields with distance (proportional to 1/r³), which creates distinctive spatial patterns.
## Dipole Moment Calculation
Once the position is established, the dipole's magnetic moment is calculated as described above. These equations are used to construct a system of linear equations for all measurement points, which is then solved using regularized least squares to find the dipole moment vector.
### Orientation Analysis
From the moment vector, the dipole's orientation is characterized by:
- Magnitude (strength of the dipole)
- Polar angle θ (angle from the vertical) \\( \theta = \arccos\left(\frac{m_z}{|\vec{m}|}\right) \\)
- Azimuthal angle φ (angle in the horizontal plane) \\( \phi = \arctan2(m_y, m_x) \\)
## Results
The quality of the inversion is typically quite good. The example below has included jitter in the measurement path, as well as 2% noise in the field measurements.
![Parametric Inversion Results](Dipole-Inversion.gif)
```
Position:
True: -7.00e-01, +3.00e-01, -1.00e+00
Predicted: -6.90e-01, +2.80e-01, -1.02e+00
Dipole moment:
True: +1.00e-05, +1.00e-05, +2.00e-05
Predicted: +9.65e-06, +1.12e-05, +1.99e-05
Dipole orientation angles:
True θ (polar): 35.3°
Predicted θ (polar): 36.6°
True φ (azimuthal): 45.0°
Predicted φ (azimuthal): 49.2°
Relative error:
Field: 2.50%
Position: 4.09%
Moment: 4.98%
```
This approach produces a comprehensive characterization of a magnetic dipole, including its position and moment vector with implied orientation angles, along with error metrics to assess the quality of the inversion. This will be used both as a benchmark for ML approaches, and possibly as an alternative to ML approaches for real-time or resource limited applications. The implementation is being actively developed, but I might share it here in the future.

Binary file not shown.

After

(image error) Size: 136 KiB

View file

@ -2,33 +2,33 @@
title = 'USM Magnetics - Sensor Fusion'
date = 2025-02-27T07:17:00-05:00
draft = false
categories = ['references']
tags = ['USM', 'magnetics', 'data science', 'KarstTech', 'UUV', 'sensor fusion']
categories = ['USM', 'magnetics']
tags = ['data science', 'KarstTech', 'UUV', 'sensor fusion']
+++
## Getting Started
Several months ago I was referred to the University of Southern Mississippi [Marine Research Center](https://www.usm.edu/ocean-enterprise/marine-research-center.php) by a coworker. They wanted some assistance from someone with a Physics and Data Science background to work on an autonomous underwater vehicle for the purpose of developing a magnetic sensing platform.
Several months ago I was referred to the University of Southern Mississippi [Marine Research Center](https://www.usm.edu/ocean-enterprise/marine-research-center.php) by a coworker. They wanted some assistance from someone with a physics and data science background to work on an autonomous underwater vehicle for the purpose of developing a magnetic sensing platform.
The work sounded interesting, so I joined the team as a contractor. Fast forward several months, and we are making fantastic progress!
The work sounded interesting, so I joined the team as a contractor. Fast forward several months and we are making fantastic progress!
The work began with using data acquired from high quality magnetic sensors including from [QUSPIN](https://quspin.com/), and processing the data to detect magnetic objects of interest. This magnetic sensing becomes a very difficult problem due to a combination of factors:
1. Magnetic fields fall off as the cube of the distance from the source (rather than the inverse square law that we all know from electromagnetic fields like light). This makes for a much more challenging problem since the size of the signals we are looking for are TINY compared to the noise in the data once we get to any significant distance from the source.
2. The Earth's magnetic field, while weak compared to some magnets that we use in everyday life, is very strong due to it's very large size and therefore slow falloff compared to small targets.
3. The targets of interest are passive ferromagnetic objects, meaning their field is created by becoming magnetized by the Earth's magnetic field. These induced magnetic fields are very weak compared to the Earth's magnetic field.
4. The sensing platform is moving, and so the vehicle's orientation, and it's vector magnetic sensor readings are changing rapidly. Imbalances in the readings between vector components due to sensor imperfections, and due to the magnetic properties of the vehicle itself make this motion difficult to filter out.
4. The sensing platform is moving, and so the vehicle's orientation, and its vector magnetic sensor readings are changing rapidly. Imbalances in the readings between vector components due to sensor imperfections, and due to the magnetic properties of the vehicle itself make this motion difficult to filter out.
![Test Vehicle](surface-vehicle.png "Test Vehicle")
## Sensor Fusion
Before we can even attempt to detect targets, we need to convert the vehicle reference frame to the Earth's reference frame. This is a non-trivial problem because the vehicle is free to rotate around the z-axis (up/down), can pitch and roll due to surface conditions, and for an underwater vehicle it can move and orient itself in virtually any direction. In addition to the vehicle orientation quickly changing, the Earth's magnetic field is very complex, and varies from location to location on the surface of the Earth.
Before we can even attempt to detect targets, we need to convert the vehicle reference frame to the Earth's reference frame. This is a non-trivial problem because the vehicle is free to rotate around the z-axis (up/down), can pitch and roll due to surface conditions and for an underwater vehicle it can move and orient itself in virtually any direction. In addition to the vehicle orientation quickly changing, the Earth's magnetic field is very complex, and varies from location to location on the surface of the Earth.
![Earth's Magnetic Field](earth-geomag.webp "Earth's Magnetic Field (courtesy of [Wikipedia](https://en.wikipedia.org/wiki/Earth%27s_magnetic_field))")
While the Earth's scale magnetic field is complex, many people assume that on the local scale, the magnetic field is constant. This is not the case, and local variations can be large enough to throw off the vehicle's orientation estimate. In a surface vehicle, this can be mitigated by using GPS to correct for long term drift of the compass / magnetic measurements, but underwater it becomes much more complicated without a detailed map of local magnetic anomalies. Designing a method for planning underwater missions which can correct for these local variations is a problem that is being addressed in the near future, but in short it involves some calibration using surface data, and then using that calibration to improve underwater navigation.
While the Earth's scale magnetic field is complex, many people assume that on the local scale, the magnetic field is constant. This is not the case, and local variations can be large enough to throw off the vehicle's orientation estimate. In a surface vehicle, this can be mitigated by using GPS to correct for long-term drift of the compass / magnetic measurements, but underwater it becomes much more complicated without a detailed map of local magnetic anomalies. Designing a method for planning underwater missions which can correct for these local variations is a problem that is being addressed in the near future, but in short it involves some calibration using surface data, and then using that calibration to improve underwater navigation.
![Local Magnetic Field Variations](gulfport-geomag.png "Local Magnetic Field Variations near Gulfport, MS")
The sensor fusion process attempts to take the best aspects of each sensor and combine them in a way that provides the most accurate estimate of the vehicle's orientation and position. For Gyroscopes, which are very accurate at measuring short term rotations, but suffer from drift over time, we can use the magnetometer to correct for the drift. We can use accelerometers to correct for quick movements, and to measure the long term orientation relative to gravity, while using GPS to provide long term movement and position data. Magnetometers are immune to the errors introduced into accelerometers by quick movements, especially in surface waves, and so they provide a very accurate measurement of the vehicle's orientation, but are subject to small errors due to local magnetic anomalies, and due to magnetic interference from the vehicle itself.
The sensor fusion process attempts to take the best aspects of each sensor and combine them in a way that provides the most accurate estimate of the vehicle's orientation and position. For gyroscopes, which are very accurate at measuring short-term rotations, but suffer from drift over time, we can use the magnetometer to correct for the drift. We can use accelerometers to correct for quick movements, and to measure the long term orientation relative to gravity, while using GPS to provide long term movement and position data. Magnetometers are immune to the errors introduced into accelerometers by quick movements, especially in surface waves, and so they provide a very accurate measurement of the vehicle's orientation, but are subject to small errors due to local magnetic anomalies, and due to magnetic interference from the vehicle itself. Work is underway to integrate doppler velocity data from a DVL sensor to improve the vehicle's estimate of its position and minimize drift from GPS reference during extended underwater missions.
The exact method used to fuse the data is highly platform specific and needs to be tuned for the physical characteristics of the vehicle, and its sensors. The diagram below shows the general process, but the exact implementation details will not be discussed here.
@ -99,5 +99,5 @@ flowchart TD
MAG_CORR --> TARGET
{{< /mermaid >}}
Once the vehicle know's it's own position and orientation through sensor fusion, we can use that information to convert the location of detected objects near the vehicle into the Earth's reference frame. This allows combining measurements from multiple passes over the same area, by multiple vehicles, or even on different days.
Once the vehicle knows its own position and orientation through sensor fusion, we can use that information to convert the location of detected objects near the vehicle into the Earth's reference frame. This allows combining measurements from multiple passes over the same area, by multiple vehicles, or even on different days.