jpilet / anemomind

Anemomind: a sailing data recording, visualization and analysis solution.
http://www.anemomind.com/
MIT License
14 stars 2 forks source link

Grammar misses tacks #1299

Open jpilet opened 6 years ago

jpilet commented 6 years ago

When I run

./src/server/nautical/nautical_processBoatLogs --boatid 5acf5b95adaa5da9ab9d06a8 \\
--dir ../../data/prod/anemologs/boat5acf5b95adaa5da9ab9d06a8 --save-default-calib  \\
--clean -c --scale 19 -t --verbose-calib

I get:

[INFO /Users/leto/Documents/anemomind/anemomind/src/server/nautical/calib/Calibrator.cpp:177] maneuver at: 2018-06-02T12:05:40 with weight 1
[INFO /Users/leto/Documents/anemomind/anemomind/src/server/nautical/calib/Calibrator.cpp:177] maneuver at: 2018-06-02T12:19:12 with weight 1
[INFO /Users/leto/Documents/anemomind/anemomind/src/server/nautical/calib/Calibrator.cpp:177] maneuver at: 2018-06-02T12:37:22 with weight 1
[INFO /Users/leto/Documents/anemomind/anemomind/src/server/nautical/calib/Calibrator.cpp:177] maneuver at: 2018-06-02T12:56:09 with weight 1
[INFO /Users/leto/Documents/anemomind/anemomind/src/server/nautical/calib/Calibrator.cpp:177] maneuver at: 2018-06-02T17:27:35 with weight 1
[INFO /Users/leto/Documents/anemomind/anemomind/src/server/nautical/calib/Calibrator.cpp:327] only 5 maneuvers, cancelling calibration.

however, when looking at the trajectory, it is clear that the boat was sailing upwind and did many tacks: https://www.anemolab.com/map/5acf5b95adaa5da9ab9d06a8?l=0.5173728794325196,0.3543986648664027,0.0018089042551497903&c=5acf5b95adaa5da9ab9d06a82018-06-02T10:11:392018-06-02T18:20:14&t=1527938531523

To obtain the results above, I had to do #1297 and #1296.

I guess it is because of the following reason. The boat is a quick boat, but does not sail very close to the wind: 50 TWA, 16-20 AWA. With a TWA of 50, maybe the system does not consider the boat is sailing upwind. I am not sure, it is just a guess.

image

jpilet commented 6 years ago

on the image, we see TWA plotted. Tacks should be easy to detect.

jonasseglare commented 6 years ago

The relevant data to reproduce this can be obtained using

mv $(lslog.js . | grep -v "Jun 02" | sed "s/ .*//" ) /tmp/a

for the boat boat5acf5b95adaa5da9ab9d06a8.

With this slice of data, 5 maneuvers are detected:

[WARNING /Users/jonas/prog/anemomind/src/server/nautical/calib/Calibrator.cpp:330] Maneuver at 2018-06-02T12:05:40
[WARNING /Users/jonas/prog/anemomind/src/server/nautical/calib/Calibrator.cpp:330] Maneuver at 2018-06-02T12:19:12
[WARNING /Users/jonas/prog/anemomind/src/server/nautical/calib/Calibrator.cpp:330] Maneuver at 2018-06-02T12:37:22
[WARNING /Users/jonas/prog/anemomind/src/server/nautical/calib/Calibrator.cpp:330] Maneuver at 2018-06-02T12:56:09
[WARNING /Users/jonas/prog/anemomind/src/server/nautical/calib/Calibrator.cpp:330] Maneuver at 2018-06-02T17:27:35

We have to add 2 hours to these times to get the corresponding time in the web interface.

jonasseglare commented 6 years ago

In commit [jo-issue-1299 97b4bef1a], I explore the tree:

[INFO /Users/jonas/prog/anemomind/src/server/nautical/grammars/WindOrientedGrammar.cpp:346] Sampled 29415 navs
[INFO /Users/jonas/prog/anemomind/src/server/nautical/grammars/WindOrientedGrammar.cpp:353] Number of states: 29415
 Top (2 children)  count 29415
spanning Nav indices in [0, 29415[ at depth 0:
   1.  Off (0 children)  count 103
   2.  Sailing (18 children)  count 29312
0. Back to parent node
-1. Select this node to return
Choice? 2

    Sailing (18 children)  count 29312
   spanning Nav indices in [103, 29415[ at depth 1:
      1.  In race (1 children)  count 436
      2.  Not in race (2 children)  count 320
      3.  In race (1 children)  count 766
      4.  Not in race (2 children)  count 1285
      5.  In race (1 children)  count 1248
      6.  Not in race (2 children)  count 2699
      7.  In race (1 children)  count 357
      8.  Not in race (2 children)  count 450
      9.  In race (1 children)  count 316
      10.  Not in race (2 children)  count 820
      11.  In race (1 children)  count 2870
      12.  Not in race (2 children)  count 5225
      13.  In race (1 children)  count 293
      14.  Not in race (2 children)  count 6903
      15.  In race (1 children)  count 2241
      16.  Not in race (2 children)  count 557
      17.  In race (1 children)  count 2104
      18.  Not in race (2 children)  count 422
   0. Back to parent node
   -1. Select this node to return
   Choice? 6

       Not in race (2 children)  count 2699
      spanning Nav indices in [4158, 6857[ at depth 2:
         1.  idle (1 children)  count 1
         2.  before-race (9 children)  count 2698
      0. Back to parent node
      -1. Select this node to return
      Choice? 2

          before-race (9 children)  count 2698
         spanning Nav indices in [4159, 6857[ at depth 3:
            1.  port-tack (8 children)  count 308
            2.  starboard-tack (3 children)  count 103
            3.  port-tack (11 children)  count 281
            4.  starboard-tack (15 children)  count 145
            5.  port-tack (39 children)  count 564
            6.  starboard-tack (17 children)  count 209
            7.  port-tack (19 children)  count 395
            8.  starboard-tack (7 children)  count 114
            9.  port-tack (30 children)  count 579
         0. Back to parent node
         -1. Select this node to return
         Choice?

We can notice that there are plenty of states segmented as "not in race". What we could try to do is to prohibit those states if segmentation fails.

jonasseglare commented 6 years ago

In branch jo-issue-1299-bak00 https://github.com/jpilet/anemomind/tree/jo-issue-1299-bak00, my approach is to repeatedly retry doing segmentation+calibration with settings that gradually encourage more and more maneuvers. Clearly a duct-tape solution, but, well, maybe it is useful...