Closed mcdonaldajr closed 3 years ago
@joabakk do you have time to look into this?
Here's the AIS sample data I was using to test. I also fed simulated position of my boat 23.47E, 37.07N to 23.56E, 37.21N moving at 0.1 knots Thanks for investigating. Anthony
@sbender9 I will have a look
@mcdonaldajr could you provide a sample file with your own gps positions as well? It is not so easy to simulate your boats movements and hit the calculations you were seeing. I think I found a bug, just need to be sure before I push it
Hehe just spent an hour comparing the code with https://github.com/jaffadog/marine-cpa-tcpa/blob/master/app.js which it turns out, is copied from my code...
Unfortunately, I simulated my GPA position using my laptop which has a GPS simulator on it, so I don't have a combined file. What I have done since then is use the CPN plugin ShipDriver as a source of GPS data. The only other thing I needed to do was use PathMapper signal K plugin to map navigation.speedThroughWater to navigation.speedOverGround as ShipDriver only simulates speedThoughWater. It is a shame that we can't slow down the reading from the AIS file to simulate real data coming in, as it just repeats rapidly in less than a minute, which is a bit confusing.
OK, We will have to make a test case for this. I am incapacitated at the moment, but I had done some research into using UTM for calculations and to set up a straight example with parallel crossing vessels. It will have to wait.
Tested to give same results as OpenCPN
derived data plug in calculating CPA as 14,588 and TCPA as 40,956. OpenCPN and SeaClear agree on CPA as 3.74NM and TCPA as 2hrs 48 minutes which I calculate at 6926 meters and 10,080 seconds. Have I misunderstood the units? Attached are the screenshots.