SUBSIM Radio Room Forums


SUBSIM: The Web's #1 BBS for all submarine and naval simulations since 1997

Go Back   SUBSIM Radio Room Forums > Modern-Era Subsims > Dangerous Waters
Forget password? Reset here

Reply
 
Thread Tools Display Modes
Old 04-10-2019, 09:02 AM   #1
ljqcn101
Sailor man
 
Join Date: Jan 2013
Location: Hong Kong
Posts: 47
Downloads: 67
Uploads: 3
Default Automatic TMA tool based on computer vision

This is my another open sourced project on automatic TMA. (code: https://github.com/LJQCN101/Auto-TMA-opencv)

Instructions on how to use is in the download page:
(old version but with speed constraints)http://www.subsim.com/radioroom/down...o=file&id=5464

(new version with maneuvering target in mind) https://www.subsim.com/radioroom/dow...o=file&id=5605

This program is meant to assist your manual TMA process, as in real world sub does, in an external and mathematical way.

It basically takes an image as input, like this image:


And it will perform cropping and line detection on the TMA display window.

The program will ask you to hand-label all the detected lines numerically in chronological order, starting from 0. This will let the program know the time sequence of each bearing line.

If the detected line appears not to be a bearing line, you can simply enter a negative number, such as -1, to exclude it from the TMA computation.

(v0.3 update) You can also enter the speed of TMA ruler so the program can calculate proper speed of each solution.
(v0.3 update) Speed constraint is added to only show solutions of specific speed.

An example of output with speed constraint of 8.3 knots, if TMA ruler corresponds to 10 knots:



An example of output without speed constraint, if TMA ruler corresponds to 5 knots:



Another example, taken from sub command tutorial:

Last edited by ljqcn101; 05-01-2020 at 09:05 AM.
ljqcn101 is offline   Reply With Quote
Old 04-10-2019, 09:07 AM   #2
ljqcn101
Sailor man
 
Join Date: Jan 2013
Location: Hong Kong
Posts: 47
Downloads: 67
Uploads: 3
Default

For anyone who is interested in the formulas of automatic TMA:

First I set three unknown variables,
1. target distance at first bearing as "L1_distance"
2. target course as "crs"
3. target speed as "spd"

Let ownship coordinate be (m,n). Y axis points to north (0 deg), and X axis points to east (90 deg). All angles start at Y axis and rotate in clockwise direction. So we can get:

1. target speed component on x axis "u" = spd * sin(crs)
2. target speed component on y axis "v" = spd * cos(crs)
3. target coordinate (a,b) at first bearing = m1+L1_distance*sin(brg1), n1+L1_distance*cos(brg1)
4. target coordinate (x,y) at time t = (a+u*t, b+v*t)
5. the vector pointing from ownship to target = (x-m, y-n)

By knowing the bearing of this vector, we can get the bearing vector equation:
(y-n)*sin(brg) = (x-m)*cos(brg)

Since we have three unknown variables to solve, in order to make sure the left hand side of the equation is really close to the right hand side, we can use the least square method:

Let formula f(t) = (y-n)*sin(brg) - (x-m)*cos(brg)
So we need to minimise the sum of squared f(t) for all bearing vectors. I used BFGS algorithm to solve this utilising C++ Dlib library.
ljqcn101 is offline   Reply With Quote
Old 05-24-2019, 01:39 AM   #3
ljqcn101
Sailor man
 
Join Date: Jan 2013
Location: Hong Kong
Posts: 47
Downloads: 67
Uploads: 3
Default

Updated to v0.3 to include speed constraint. Check the examples in the original post.
ljqcn101 is offline   Reply With Quote
Old 04-30-2020, 04:12 AM   #4
ljqcn101
Sailor man
 
Join Date: Jan 2013
Location: Hong Kong
Posts: 47
Downloads: 67
Uploads: 3
Default

Hi, I decided to do some further research and implement a real-life method called 'Maneuvering Target Statistical Tracker (MTST)', which assumes that the target is maneuvering.

A simple history of this method:
Quote:
In 1980-81 at COMSUBPAC, W. H. Barker of DHWA employed IOU/SDE/Kalman methods to develop the Maneuvering Target Statistical Tracker (MTST). This TDA was the first operational program to take this approach. Barker improved the earlier algonthms and Importantly added a smoother by forwardbackward filtering to eliminate outliers. MTST has been extended further by Barker, Kierstead, W. R. Stromquist, N. L. Gerr, and others of DHWA. Its methodology, discussed in 3.5, is believed to be state-of-the-art in maneuvering target tracking. It has been incorporated in submarine combat control systems. It is also used in automated reconstruction by NTSA.
ljqcn101 is offline   Reply With Quote
Old 04-30-2020, 04:55 PM   #5
ET2SN
Commodore
 
Join Date: Oct 2017
Posts: 622
Downloads: 31
Uploads: 0


Default

Quote:
Originally Posted by ljqcn101 View Post
employed IOU/SDE/Kalman methods

I had to know how a Kalman filter worked for one piece of Navy hardware and later for some systems I worked on as a field engineer for Kodak.



Just be careful. When the filter gets good data its no big deal. When it gets bad data, things go south very quickly.

This is very cool, just remember that TMA also has a Zen component and you need to be good at taking a guess every now and then.
ET2SN is online   Reply With Quote
Old 05-01-2020, 05:28 AM   #6
ljqcn101
Sailor man
 
Join Date: Jan 2013
Location: Hong Kong
Posts: 47
Downloads: 67
Uploads: 3
Default

Yeah it does require an estimate regarding how much the target can change its course or speed.

I'm using most of its idea like IOU but didn't strictly following the paper though. Here's a preliminary result and I've uploaded for download, check my signature.



ljqcn101 is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -5. The time now is 06:55 PM.


Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright © 1995- 2020 Subsim