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

Mark laylines do not appear for west longitudes or south latitudes #48

Open
Rasbats opened this issue Jan 20, 2024 · 82 comments
Open

Mark laylines do not appear for west longitudes or south latitudes #48

Rasbats opened this issue Jan 20, 2024 · 82 comments

Comments

@Rasbats
Copy link

Rasbats commented Jan 20, 2024

The same problem as Dashboard_Tactics.
Fixed in this file:
tactics_pi.cpp.txt

@rgleason
Copy link
Owner

rgleason commented Jan 25, 2024

Here are the find getlineintersection in my version of tactics_pi.cpp
https://github.com/Rasbats/tactics_pi/blob/master/src/tactics_pi.cpp

Search "getlineintersection" (3 hits in 1 file of 1 searched) [Normal]
  C:\Users\fcgle\source\tactics_pi\src\tactics_pi.cpp (3 hits)
	Line  998: wxRealPoint GetLineIntersection(wxRealPoint line1point1, wxRealPoint line1point2, wxRealPoint line2point1, wxRealPoint line2point2)
	Line 1349: 					intersection_pos = GetLineIntersection(c_end, c_end2, m_end, m_end2);
	Line 1457: 				pIntersection_pos = GetLineIntersection(pc_end, pc_end2, pm_end, pm_end2);

Here are the getlineintersection in your version of tactics_pi.cpp (direct from your repo)
https://github.com/Rasbats/tactics_pi/blob/master/src/tactics_pi.cpp

Search "getlineintersection" (1 hit in 1 file of 1 searched) [Normal]
  C:\Users\fcgle\Downloads\tactics_pi.cpp (1 hit)
	Line  777: wxRealPoint GetLineIntersection(wxRealPoint line1point1, wxRealPoint line1point2, wxRealPoint line2point1, wxRealPoint line2point2)

However I find no GCIntersectSegment In this file or the tactics_pi.cpp from rgleason repo!

@rgleason
Copy link
Owner

rgleason commented Jan 25, 2024

In the version of that you uploaded here tactics.cpp.txt I find

Search "GCIntersectSegment" (3 hits in 1 file of 1 searched) [Normal]
  C:\Users\fcgle\Downloads\tactics_pi.cpp.txt (3 hits)
	Line 1085: bool GCIntersectSegment(double lat1A, double lon1A, double lat1B, double lon1B,
	Line 1646:           GCIntersectSegment(
	Line 1804:         GCIntersectSegment(pc_end.y, pc_end.x, pc_end2.y, pc_end2.x, pm_end.y,

Is your repo for tactics different than the tactics_pi.cpp.txt that you uploaded?

@rgleason
Copy link
Owner

How would I test for this problem, using shipdriver? I'd like to be sure that it is a problem with this version first.

@Rasbats
Copy link
Author

Rasbats commented Jan 25, 2024

Just updated tactics_pi repo. Look around line 1644. ShipDriver for test purposes was posted on the Crusers Forum. I will find the post #.

@rgleason
Copy link
Owner

rgleason commented Jan 25, 2024

Mike, I think I downloaded that version and have it. What do I do to test?

I have ShipDriver-3.3.3+1440.630b67d_msvc-wx32-10-win32.tar.gz and will install it.

@Rasbats
Copy link
Author

Rasbats commented Jan 25, 2024

  1. Get a grib file for the area you want to test in
  2. Install ShipDriver
  3. Move your boat to somewhere in the grib area
  4. Right-click "Select vessel start position"
  5. Press the Start button for ShipDriver
  6. The grib file loads and shows the wind where the boat is located
  7. Increase speed to say 10kts

If you have tactics_pi loaded you should see the polar and the boat laylines. You may need to sail close hauled by changing course with ShipDriver.

@Rasbats
Copy link
Author

Rasbats commented Jan 25, 2024

The version needed is 999 further down the list.
ShipDriver-999.0.0+1439.33557f0_msvc-wx32-10-win32(1).tar.gz

@rgleason
Copy link
Owner

Ah not a VDR file, I was using one of Thomas Rauch's Tactics VDR files. It should be a current grib file, that makes good sense.
I will update to the 999 version now.
This should be run in the north west? What about south west?

@rgleason
Copy link
Owner

rgleason commented Jan 25, 2024

Here ship is next to Japan, downloaded a grib file, set grib to play, click start, then prompted to move ship to position. Close the message and right click and set boat position. Tactics is open, but not receiving weather data, grib file is playing.
Do I need to configure a port or something? No data in nmea0183 window.

Screenshot (1887)

@Rasbats How do I configure connections to get grib weather data into nmea0183? Are there some connection details needed?

@rgleason
Copy link
Owner

@Rasbats How do I configure connections to get grib weather data into nmea0183? Are there some connection details needed?

@Rasbats
Copy link
Author

Rasbats commented Jan 25, 2024

No connection need changing/setting up.
It is the order of each step that needs to be followed.

  1. Close the grib
  2. "Select vessel start position"
  3. Start
  4. The grib plugin opens and shows the wind for the current time
  5. Increase the speed a little

In the NMEA Debug window you will see the stream of nmea messages for wind.

@Rasbats
Copy link
Author

Rasbats commented Jan 25, 2024

Oh ... have you set up a Tactics temp. WP and are tacking towards it?

@Rasbats
Copy link
Author

Rasbats commented Jan 25, 2024

The fix works for SouthWest: Here is an example for seas off Chile.

chile

@rgleason
Copy link
Owner

rgleason commented Jan 25, 2024

Yes, of course I've set a TacticsWP there is no other way to get laylines, but there is no data going into Tactics or into the Nmea0183 window

Correction: I had not set the WP!!!
but it still does not seem to be getting data.

@Rasbats
Copy link
Author

Rasbats commented Jan 25, 2024

I will test on another machine that has not seen this problem.

@rgleason
Copy link
Owner

rgleason commented Jan 25, 2024

Now I have an active route on the right because I set the TacticsWP. Have not seen any data. The speed is set to be more than 0 but does not show yet. I click on the Play for Grib too.

Is there a certain kind of grib needed? Like with very small interval 3hr or 1 hr?
I tried turning off all the green buttons below, but I guess that is not a function.

Screenshot (1893)

I've downloaded and am using ShipDriver-999.0.0+1439.33557f0_msvc-wx32-10-win32(1).tar.gz
but I will download it again and reinstall.

@Rasbats
Copy link
Author

Rasbats commented Jan 25, 2024

" I click on the Play for Grib too."
Just starting SD should open the grib file at the correct time. No need to touch the grib_pi apart from selecting the correct grib. ShipDrive is getting the information from the grib using json.

@Rasbats
Copy link
Author

Rasbats commented Jan 25, 2024

I am testing Chile with a 6hr grib!

@rgleason
Copy link
Owner

rgleason commented Jan 25, 2024

Ok. That's helpful. I haven't see grib open when SD is opened yet. Will try some more.

I have now first download a grib and loaded it into grib.
Turn off grib.

  1. Move boat here used.
  2. Set a TacticsWP to windward.
  3. Hover over TacticsWP and right click and pick "Nav to here" and made another point to go to next to it
  4. In any case, the Active Route Console is up.
  5. With Grib off, Open Shipdriver hit Start
  6. Message Right click and pick ship start location. (Have to first close this message, as can do nothing, not intuitive.)
  7. Ok the message, then right click and pick ship start location... What, it should be "Select Vessel Start Location"? at the bottom. I was not doing that!
  8. But Right click at the vessel start location and then picking "Vessel start location" does not seem to move the vessel.
  9. Ok I removed active route, and the tacticsWP. What order?
  10. I can get it to change headings, but I can't get speed to be >0. Also gribs does not open automatically.

Screenshot (1894)

This post is from when I had grib open and a TacticsWP set with an active route.
Boy I'd like to get this working.

@Rasbats
Copy link
Author

Rasbats commented Jan 25, 2024

It looks like you may not be using SD v999.

@rgleason
Copy link
Owner

rgleason commented Jan 25, 2024

Werner would really like this improvement too. He's in Puerto Montt right now, going down through Patagonia next.
karmavanstaal.nl Met him in NZ

@Rasbats
Copy link
Author

Rasbats commented Jan 25, 2024

Have just set up a new OpenCPN 5.8.4. Works as I would expect it to.
Need to get this working. Essential for testing.

@rgleason
Copy link
Owner

Ya, that's kind of what I thought. Is this 999 ? ShipDriver-999.0.0+1439.33557f0_msvc-wx32-10-win32(1).tar.gz

Maybe there is another one?

@Rasbats
Copy link
Author

Rasbats commented Jan 25, 2024

Yes. The same as in Cloudsmith, just the second copy in my Downloads. And the one I used for the new setup.

@Rasbats
Copy link
Author

Rasbats commented Jan 25, 2024

"Ok I removed active route, and the tacticsWP. What order?"
No need to activate a route for tactics_pi. Just drop the tactics mark.

@rgleason
Copy link
Owner

Humm. So I am using the right one. I am missing something in its operation? Must I put in an MMSI?

@rgleason
Copy link
Owner

rgleason commented Jan 25, 2024

Ok no active route, just drop TacticsWP.

What about "But Right click at the vessel start location and then picking "Vessel start location" does not seem to move the vessel."?

Any way to get rid of the mmsi? Just enter a number?

@rgleason
Copy link
Owner

rgleason commented Jan 25, 2024

Ok I entered a 9 digit MMSI number and it is starting to work.
I think your MMSI message should say You MUST enter a 9 digit number for this plugin to work.

I can now get speed 6-10knots showing and can control the rudder.
The own boat does show but it is not moving or turning in accord with shipdriver.

I have changed some grib settings under playback to. Playback, Loop mode, top of gib, interpolate with 2 min intervals.

I am not getting any movement to the boat and none of the tactics overlays are working for some reason. Is opengl the problem I wonder?

I do have some data in tactics instruments, but not full data. Also it is static, not dynamically changing.
Screenshot (1898)

@rgleason
Copy link
Owner

rgleason commented Jan 25, 2024

@Rasbats Starting to work. Have to enter mmsi number. Still some issues.

@Rasbats
Copy link
Author

Rasbats commented Jan 27, 2024

PR #49 shows my changes. Note that the code for non-intersections remains but is not used.

pr

@Rasbats Rasbats changed the title Mark laylines do not appear for west longitude, north latitude Mark laylines do not appear for west longitudes or south latitudes Jan 27, 2024
@rgleason
Copy link
Owner

Thank you MIke! I am studying this and have a couple of questions. First I tried downloading the tarball and installing it in OpenCPN to see how it worked, but when I try to import it is incompatible and the filename is missing "wx32"
https://cloudsmith.io/~opencpn/repos/tactics-beta/packages/?q=1.0.81

I think I am going to make a new "test" branch and PR your changes to that. Then try to test in OpenCPN, just to be sure.
Thanks. I may be back to you. Hope you're boat work goes well. It's cold and has been raining a whole lot here.

@rgleason
Copy link
Owner

I guess that is the best way to do this. Made a new branch "laylines" and the made a new PR from rasbats to rgleason/tactics/laylines in the github web interface.
https://github.com/rgleason/tactics_pi/tree/laylines

We'll see how it builds and installs.

@rgleason
Copy link
Owner

It built and looks ok https://cloudsmith.io/~opencpn/repos/tactics-alpha/packages/?q=1.0.81.0+msvc+tarball
It loaded, and I have shipdriver running in Japan towards tacticWP, with grib data going to tactics, and the boat is moving and I can steer it.
There do not appear to be any polar, laylines or current at the boat, also there is no active route line to the tacticWP, however there is an artifact that disappears when I delete the tacticWP. Do you have any ideas?
Screenshot (1934)

Screenshot (1933)
Screenshot (1932)

@Rasbats
Copy link
Author

Rasbats commented Jan 27, 2024

Easy one ... just close and restart OpenCPN.

@Rasbats
Copy link
Author

Rasbats commented Jan 27, 2024

The problem with Japan may be due to the time interval between charts - 6 hours? Try using a grib from the North Sea;
https://marine.meteoconsult.co.uk/marine-services/grib-files
These are in 1 hour steps.

@rgleason
Copy link
Owner

Gone back to Adriatic and tried using shipdriver again with this
GFS20240125174902161 - Copy.grb.docx

Using shipdriver.
When I don't have grib running everything except the polars show laylines etc.
When I turn on the grib file, that all dissappears.
Screenshot (1935)

Screenshot (1936)

@rgleason
Copy link
Owner

rgleason commented Jan 27, 2024

I think you've missed some code.

You should try this version yourself, I think you'll see what I mean.
https://cloudsmith.io/~opencpn/repos/tactics-alpha/packages/?q=1.0.81.0+msvc+tarball

We're using the Laylines branch, it seems to build ok and the deployment is to here in cloudsmith.
https://cloudsmith.io/~opencpn/repos/tactics-alpha/packages/?q=1.0.81.0+msvc+tarball

You can increment the last version digit, it will make the builds a little easier to handle, if you push something else.

We're headed to mystic ct (1-2hrs)

@Rasbats
Copy link
Author

Rasbats commented Jan 27, 2024

adriatic
I needed to alter course to refresh the drawing of the lines.

@Rasbats
Copy link
Author

Rasbats commented Jan 27, 2024

To avoid confusion it may be better to use a new version number.

@rgleason
Copy link
Owner

Here is another example. No laylines and no polar even though in adriatic.
Screenshot (1942)

Wait, found the problem.... no polar!!

@rgleason
Copy link
Owner

rgleason commented Jan 27, 2024

Ok now using Alberg 36 polar. and it is working in the adriatic with the tactics VDR file.
Tactics-sample3-11m.txt

Screenshot (1944)

There are lots of moving parts. I guess I have to test it in the other hemisphere next. Sorry about that.

@Rasbats
Copy link
Author

Rasbats commented Jan 27, 2024

A VDR for the Adriatic, using your grib:
adriatic.txt

@rgleason
Copy link
Owner

rgleason commented Jan 27, 2024

Mike, I went back to Japan, using this grib with it set to interpolate to 30 minutes, and (with a good polar file!) it was showing the laylines and polar file and the tacking angles. However the laylines do not make sense to me. I think some calc might be off.
The laylines don't seem to go to the TacticsWP the head out to wherever and one of the tacking angles is Also some of the tacking angles isn't where I would expect. I'll attach the grib and the screenshots.
Then will try your adriatic, but I had that working ok in that part of the globe.

Screenshot (1945)

Screenshot (1946)

Screenshot (1947)

Screenshot (1948)

Note: the version being used is in the github/rgleason/tactics/ Laylines branch which has Mikes PR to fix laylines through out the globe. Deployment is to here in cloudsmith. https://cloudsmith.io/~opencpn/repos/tactics-alpha/packages/?q=1.0.81.0+msvc+tarball

@Rasbats
Copy link
Author

Rasbats commented Jan 28, 2024

My fix fails for Japan. The intersection is completely wrong.
It seems that when longitude is more than 90E or 90W the function does not work.
@bdbcat Do you have any code for the intersection point of two lines drawn on the chart?
My reference:
https://www.codeguru.com/cplusplus/geographic-distance-and-azimuth-calculations/

@Rasbats
Copy link
Author

Rasbats commented Jan 28, 2024

This shows where the intersection should be:

inter question

@Rasbats
Copy link
Author

Rasbats commented Jan 28, 2024

At the end of the GCIntersectSegment function I added some corrections.

  lat3A *= GEO::RA2DE;
  lon3A *= GEO::RA2DE;
  lat3B *= GEO::RA2DE;
  lon3B *= GEO::RA2DE;

  if (lon1A < -90) {
    double dd = 180 + lon3A;
    dd *= -1;
    lon3A = dd;
  } else if (lon1A > 90) {
    double dd = 180 - lon3A;
    lon3A = dd;  
  }

No idea why but this seems to correct the problem.
japan

@rgleason
Copy link
Owner

Very nice fix Mike. I am very impressed and wish I knew enough to do that. Thanks for all your help fixing this!!! If you want to PR my repo laylines (...I will do that now. and test again) This is a fast itteration..

@rgleason
Copy link
Owner

Mike your change has been built. It is one of the top two.
https://cloudsmith.io/~opencpn/repos/tactics-alpha/packages/?q=1.0.81.0+msvc+tarball

I have tested it in Japan, and it appears to be working here a lot better. Have not tested it elsewhere. Grib file used

Japan-GFS20240125125301697.grb.pdf
Remove the pdf.

Screenshot (1971)
Screenshot (1973)
Screenshot (1974)
Screenshot (1975)

@rgleason
Copy link
Owner

I need to test this some more, in different places on the globe, etc.

@rgleason
Copy link
Owner

rgleason commented Feb 1, 2024

Mike, using version Tactics 1.0.81.4 from rgleason/Laylines which has your most recent PR and some TP updates from me. It appears to me that this version is at least built so that installs, and the filename has "wx32" as it should.
It is using WxWidgets 3.2.2 and it appears to build on all OS. It appears to be installing properly.
The deployment is here https://cloudsmith.io/~opencpn/repos/tactics-beta/packages/?q=msvc+1.0.81.4+tarball

Tonight I tested 1.0.81.4 it in the Adriatic and Japan, and in both places the laylines seem to have changed, (I think it was better before the last change.)

I am going to post the results of the two examples. next.

@rgleason
Copy link
Owner

rgleason commented Feb 1, 2024

@Rasbats
Copy link
Author

Rasbats commented Feb 2, 2024

Yes. Using the return value of GCIntersect does not work! Latest PR assumes we always have an intersect.
Version 1.0.81.5
The checks do not create the wx32 version in Cloudsmith. Please can you make this version for testing again.

@rgleason
Copy link
Owner

rgleason commented Feb 2, 2024

Mike,
I am not completely understanding.
v1.0.81.4 Using the return value of GCIntersect and you confirm that it does not work
v1.0.81.5 The latest PR, "assumes we always have an intersect" <<---You want me to merge this and build it again for testing?

"The checks do not create the wx32 version in Cloudsmith. Please can you make this version for testing again."
What? I can't figure out why not. I think it should. Bdcat does this on other plugins and it builds properly.

Have you merged my PR from before that is intended to fix this?
I see the bottom of the appveyor build -- I am stumped. I do know we are no longer using appveyor for building windows, but are using circleci tools in the scripts. So perhaps that is what is happening and is the answer. The appveyor script should be changed. The reason we moved away from it was that it was not doing windows headers properly. Bdbcat did extensive trials and they would not fix it. I will merge and it should build properly. --Sorry about this issue. I will try to fix appveyor so at least that does not happen, but the problem with the windows header file still exists....

Checking raw package upload parameters ... OK
..  Created: opencpn/tactics-alpha/tactics_pi-10815-msvc-x86_64-wx-10014393-msvct-mdV (zh0hozTysRQU)
Build success

@rgleason
Copy link
Owner

rgleason commented Feb 2, 2024

Mike, if you look at this PR page #55
you will see that for windows wx32 it built properly using the circleci script. See the green check marks?
I think we will find a good version for wx32 in tactics-alpha, that you created.

Hum, that is another stumper. Its not wx32 but is still wx
https://cloudsmith.io/~opencpn/repos/tactics-alpha/packages/?q=msvc+1.0.81.5+tarball

Going back to your PR build it looks ok to me
https://app.circleci.com/pipelines/github/rgleason/tactics_pi/111/workflows/98689a6e-7058-4479-a7d6-f4a08f6b7d5a/jobs/1844
but it is not deploying because of the cloudsmith key.
You are a member of the Cloudsmith Opencpn Plugin Team, I think the permission settings on Tactics are not right. I will fix them.
but I wonder where the wrong version comes from? Perhaps it is from the Appveyor build that is done and completed from your repo? Yes, I think that is the answer.

Your repo and your use has access to deploy to Cloudsmith Tactics, ....but your PR does not?
...still learning Cloudsmith.

I will just merge this right now.

@rgleason
Copy link
Owner

rgleason commented Feb 2, 2024

Mike it is found in Tactics-alpha with a search "1.0.81.5+msvc+wx32+tarball" here https://cloudsmith.io/~opencpn/repos/tactics-alpha/packages/?q=1.0.81.5+msvc+wx32+tarball

The rest of the macos and debian are completing. I will try to test it tonight. Thanks so much.
Will look into getting the PR built versions to deploy, but that may be an intentional safeguard.
Don't know why your local to your remote repository pushes don't build the circleci, config.yml script as expected but just build only appveyor? It may be because you have not enabled circleci Dashboard for Tactics?

PS: I think you should disable Tactics and the other TP plugins in your Appveyor Dashboard. That will help eliminate some of the confusion.

@rgleason
Copy link
Owner

rgleason commented Feb 3, 2024

Mike version 1.0.81.5 seems to be working for me in Japan, Adriatic and USA east coast. Should I check in any other locations before merging your PR with master?

Where have you checked it?

Screenshot (2000)
Screenshot (2001)
Screenshot (2002)

@Rasbats
Copy link
Author

Rasbats commented Feb 3, 2024

Tested Vancouver Island, BC and Tasmania. Looks good to me. It would be nice to have other users testing this.

@Rasbats
Copy link
Author

Rasbats commented Aug 15, 2024

The GCIntersectSegment function has gone walkabout.
Using the SD template I made a temporary alpha here:
https://cloudsmith.io/~mike-rossiter/repos/tactics-alpha/packages/
Sorry about the version numbering.
Works in South latitudes, East longitudes. Others not tested.

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

No branches or pull requests

3 participants