Cruisers Forum
 

Go Back   Cruisers & Sailing Forums > Seamanship, Navigation & Boat Handling > OpenCPN
Cruiser Wiki Click Here to Login
Register Vendors FAQ Community Calendar Today's Posts Log in

Reply
  This discussion is proudly sponsored by:
Please support our sponsors and let them know you heard about their products on Cruisers Forums. Advertise Here
 
Thread Tools Search this Thread Rate Thread Display Modes
Old 18-12-2021, 09:44   #46
Registered User

Join Date: Feb 2019
Location: Cartagena, Spain
Boat: Furia 372 - 11.20m
Posts: 348
Re: AutoTrackRaymarine_pi: Remote control and route following for Evolution Pilots

I'm not talking about GNSS location accuracy. Even assuming that the position error is 0m, what I have pointed out before corresponds exclusively to the calculation of the XTE with a supposedly constant radius of the earth.
That is the conclusion that I draw by analyzing the spherical trigonometry expressions:
Code:
/ -----------------------------------------------------------------------------
// CROSSARC Calculates the shortest distance in meters 
// between an arc (defined by p1 and p2) and a third point, p3.
// Input lat1,lon1,lat2,lon2,lat3,lon3 in minutes-4.

int32_t crossarc(int32_t lat1, int32_t lon1, int32_t lat2, int32_t lon2, int32_t lat3, int32_t lon3)
{
  double latA = torad(lat1), latB = torad(lat2), latC = torad(lat3);
  double lonA = torad(lon1), lonB = torad(lon2), lonC = torad(lon3);
  // Prerequisites for the formulas
  double bear12 = bear(latA, lonA, latB, lonB);
  double bear13 = bear(latA, lonA, latC, lonC);
  double dis13 = dis(latA, lonA, latC, lonC);

  return(asin(sin(dis13 / RADIUSm) * sin(bear13 - bear12)) * RADIUSm);
}
RADIUSm is taken as 6371000.0 if the result is wanted in meters, and 3440436.332 if the result is in Nautical miles^-3. But it is always the same value without counting the coordinates of the navigation area.

The complementary functions to calculate bearing and distance are these:
Code:
// Finds the Orthodromic angle between two points, all angles in radians
double bear(double lat1, double lon1, double lat2, double lon2)
{
  double S, C, dvalue;

  dvalue = lon1 - lon2;
  S = cos(lat2) * sin(dvalue);
  C = cos(lat1) * sin(lat2) - sin(lat1) * cos(lat2) * cos(dvalue);
  return(atan2(S,C));
}
Code:
// Finds the distance between two lat/lon points. all angles in radians
// Return: distance in meters
double dis(double lat1, double lon1, double lat2, double lon2)
{
  return(acos(sin(lat1) * sin(lat2) + cos(lat1) * cos(lat2) * cos(lon2 - lon1)) * RADIUSm);
}
Since I am using the position in minutes ^ -4, the conversion to radians is like this:
Code:
// Converts an angle from minutes^-4 to radians.
double torad(int32_t value)
{
  return(PI * (double) value / (180.0f * 600000.0f));
}
I have not looked at the Ocpn code, and I am unaware if it also does it this way or similar.
Tehani is offline   Reply With Quote
Old 18-12-2021, 09:57   #47
Registered User

Join Date: Feb 2019
Location: Cartagena, Spain
Boat: Furia 372 - 11.20m
Posts: 348
Re: AutoTrackRaymarine_pi: Remote control and route following for Evolution Pilots

Quote:
Originally Posted by rgleason View Post
If you have a large rudder and a strong fast autopilot, can the sharp turns cause a crack in the rudder? I was just reading about an owner of a Bristol 32 who installed a new under deck rudder actuator and autopilot and the next year he noticed a crack in the front of the rudder at the top, so is now rebuilding the glass on the front of the rudder. He thinks it may be due to strength of the new autopilot.

Perhaps a radius at turning would help?
Your friend will surely be able to adjust the boat maximum turning speed. The maximum value that Raymarine sets by default is 20 deg / second.
Tehani is offline   Reply With Quote
Old 18-12-2021, 12:50   #48
Registered User

Join Date: Jun 2010
Location: St. Petersburg, Florida
Boat: Gemini 3200
Posts: 983
Re: AutoTrackRaymarine_pi: Remote control and route following for Evolution Pilots

What do these mean? "^-3" and "^ -4"
fgd3 is offline   Reply With Quote
Old 18-12-2021, 13:05   #49
Registered User
 
akopac's Avatar

Join Date: Oct 2014
Location: South Pacific -> World Cruising Long Term
Boat: Morgan, West Indies 38 Ketch
Posts: 573
Re: AutoTrackRaymarine_pi: Remote control and route following for Evolution Pilots

How do I install AutoTrackRaymarine_pi?
akopac is offline   Reply With Quote
Old 18-12-2021, 16:25   #50
Registered User

Join Date: Feb 2019
Location: Cartagena, Spain
Boat: Furia 372 - 11.20m
Posts: 348
Re: AutoTrackRaymarine_pi: Remote control and route following for Evolution Pilots

Quote:
Originally Posted by fgd3 View Post
What do these mean? "^-3" and "^ -4"
Sorry, it means "exponent".
miles ^ -3 would be the same as thousandths of a mile, or miles / 1000.
Tehani is offline   Reply With Quote
Old 19-12-2021, 03:45   #51
Registered User

Join Date: Oct 2011
Location: Apeldoorn
Boat: Ovni 385
Posts: 343
Re: AutoTrackRaymarine_pi: Remote control and route following for Evolution Pilots

Quote:
Originally Posted by Tehani View Post
I'm not talking about GNSS location accuracy. Even assuming that the position error is 0m, what I have pointed out before corresponds exclusively to the calculation of the XTE with a supposedly constant radius of the earth.
That is the conclusion that I draw by analyzing the spherical trigonometry expressions:
[CODE]/ -----------------------------------------------------------------------------
have not looked at the Ocpn code, and I am unaware if it also does it this way or similar.
Better take a look in the OpenCPN code. See routeman.cpp, Routeman::UpdateProgress(). For updating the XTE DistanceBearingMercator() is used. Here the radius of the earth is not interesting, nor is it when I sail the waters around my country. Crossing oceans you might do great circle calculations, but even great circle routes will normally be split up in rhumb line segments.
Douwe
Douwe Fokkema is offline   Reply With Quote
Old 19-12-2021, 08:01   #52
Registered User

Join Date: Oct 2011
Location: Apeldoorn
Boat: Ovni 385
Posts: 343
Re: AutoTrackRaymarine_pi: Remote control and route following for Evolution Pilots

Quote:
Originally Posted by akopac View Post
How do I install AutoTrackRaymarine_pi?
Rick recently did some updates to the user interface. So I compiled the lot again for Windows. The installation package can be found here: https://www.dropbox.com/s/ath5jsg43s...19043.exe?dl=0
Later this week I will try to make a tarball that can be imported with the pluginmanagar.

Douwe
Douwe Fokkema is offline   Reply With Quote
Old 19-12-2021, 16:09   #53
Registered User
 
akopac's Avatar

Join Date: Oct 2014
Location: South Pacific -> World Cruising Long Term
Boat: Morgan, West Indies 38 Ketch
Posts: 573
Re: AutoTrackRaymarine_pi: Remote control and route following for Evolution Pilots

Quote:
Originally Posted by Douwe Fokkema View Post
Rick recently did some updates to the user interface. So I compiled the lot again for Windows. The installation package can be found here: https://www.dropbox.com/s/ath5jsg43s...19043.exe?dl=0
Later this week I will try to make a tarball that can be imported with the pluginmanagar.

Douwe


Cool. I have a RPI, Mac, and windows system
akopac is offline   Reply With Quote
Old 20-12-2021, 12:49   #54
Registered User

Join Date: Feb 2019
Location: Cartagena, Spain
Boat: Furia 372 - 11.20m
Posts: 348
Re: AutoTrackRaymarine_pi: Remote control and route following for Evolution Pilots

Quote:
Originally Posted by rgleason View Post
I believe a change was made in OpenCPN for the more accurate 5 decimal points.
Perhaps the circumference of the earth should be made to vary linearly dependent on position? Or maybe adjust the number of decimals used?
Thank you very much Douwe, I found that place.
Rick, what you say is already being done. Everything OK.
Calculations with GEODESIC_WGS84_SEMI_MAJORAXIS and GEODESIC_WGS84_SEMI_MINORAXIS in geodesic.cpp and georef.cpp
Tehani is offline   Reply With Quote
Old 20-12-2021, 12:55   #55
Registered User

Join Date: Feb 2019
Location: Cartagena, Spain
Boat: Furia 372 - 11.20m
Posts: 348
Re: AutoTrackRaymarine_pi: Remote control and route following for Evolution Pilots

And of course, thanks Dave.
Tehani is offline   Reply With Quote
Old 22-12-2021, 15:36   #56
Registered User
 
rgleason's Avatar

Join Date: Mar 2012
Location: Boston, MA
Boat: 1981 Bristol 32 Sloop
Posts: 17,783
Images: 2
Re: AutoTrackRaymarine_pi: Remote control and route following for Evolution Pilots

Tehani, Thanks, that is good to know, also about the adjustment to turning speed in the autopilot itself.

Douwe, thanks for your plugin and taking it on again. If you want some help getting the cloud services and deployment going, I am ready willing and able to help you.

Quote:
Originally Posted by Tehani View Post
Thank you very much Douwe, I found that place.
Rick, what you say is already being done. Everything OK.
Calculations with GEODESIC_WGS84_SEMI_MAJORAXIS and GEODESIC_WGS84_SEMI_MINORAXIS in geodesic.cpp and georef.cpp
rgleason is offline   Reply With Quote
Old 26-12-2021, 13:20   #57
Registered User

Join Date: Feb 2019
Location: Cartagena, Spain
Boat: Furia 372 - 11.20m
Posts: 348
Re: AutoTrackRaymarine_pi: Remote control and route following for Evolution Pilots

Quote:
Originally Posted by rgleason View Post
Tehani, Thanks, that is good to know, also about the adjustment to turning speed in the autopilot itself.
Sorry, it is not good choice to run too much ...

Taking a closer look at the code, I have seen that Ocpn is not using the "GreatCircleDistBear" function from geodesic.cpp, but the less exact "DistanceBearingMercator" from georef.cpp, to use the results in the function "vGetLengthOfNormal", which is the that XTE achieves. This uses 2D geometry on every complete leg of a route.

I don't think that "GreatCircleDistBear" will put a lot of load on the CPU, because it is being used to draw the orthodrome. However, this may have been done to make distances and angles compatible with the Mercator projection of the charts.

I have been comparing results using 3D (spherical and ellipsoidal) and 2D geometry. I have done virtual navigations in several latitudes, and I think that Ocpn could use simple spherical trigonometry to generate RMB and XTE, since in short legs (less than 10 Nm), the difference with the Mercator projection is negligible in bearing (0.001 deg), distance (equal) and XTE (0.02-0.03%).

However, using 2D geometry for long distances is not optimal. An AP can change course progressively.

I am using the procedures of this web:
https://www.movable-type.co.uk/scripts/latlong.html

They are sphere based, not ellipsoid, and are much less heavy than those used in geodesic.cpp and georef.cpp. When used to simultaneously calculate Bearing, Distance, XTE, and VMG, repeated trigonometric functions can be grouped together.
My opinion is that it would be interesting to use spherical geometry for all cases. I have written a single "C" module to compare all three methods, here is the link:
https://drive.google.com/drive/folde...0n?usp=sharing
Tehani is offline   Reply With Quote
Old 26-12-2021, 15:31   #58
Registered User
 
akopac's Avatar

Join Date: Oct 2014
Location: South Pacific -> World Cruising Long Term
Boat: Morgan, West Indies 38 Ketch
Posts: 573
AutoTrackRaymarine_pi: Remote control and route following for Evolution Pilots

Go Tehani Go, I’m dying to see your pi version. I’ll Beta test it if you need a hand[emoji41]
akopac is offline   Reply With Quote
Old 27-12-2021, 04:21   #59
Registered User

Join Date: Feb 2019
Location: Cartagena, Spain
Boat: Furia 372 - 11.20m
Posts: 348
Re: AutoTrackRaymarine_pi: Remote control and route following for Evolution Pilots

Quote:
Originally Posted by akopac View Post
Go Tehani Go, I’m dying to see your pi version. I’ll Beta test it if you need a hand[emoji41]
I had no intention of touching the Ocpn code. I am engaged in other battles ...

However, I am approaching positions for a beta. Now I have added XTE_test1.c to the shared folder. In this file is the "bear_dist_xte" function that calculates in a very compact way, almost everything that the RMB sentence contains. Only VMG is missing, which I hope to add soon.
Tehani is offline   Reply With Quote
Old 27-12-2021, 07:29   #60
Registered User
 
rgleason's Avatar

Join Date: Mar 2012
Location: Boston, MA
Boat: 1981 Bristol 32 Sloop
Posts: 17,783
Images: 2
Re: AutoTrackRaymarine_pi: Remote control and route following for Evolution Pilots

Tehani, thank you for the good link and the downloads. I added the link to our User Manual, under Advanced. I have downloaded and tried the first exe (after restoring from Norton quarantine). When I completed it the screen went blank, so I will have to try it again.

What do you mean by "Sorry, it is not good choice to run too much ..."?

Also, do I understand correctly, that you think these calculations are better and faster than the ones used in OpenCPN?

I have some results of a successful test with AutoTrackRaymarine after corresponding with Mike and Douwe, and will post and push the code up to a new PluginName, just to help keep installation simple, I am calling it ShipDriverTracker_pi. (I am hoping that Mike will add this Mode to ShipDriver after we test with some other autopilot plugins.)


I will be posting this information in Desktop Testing of Autopilot Plugins thread
rgleason is offline   Reply With Quote
Reply

Tags
marine, raymarine, remote, route


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
Trackbacks are Off
Pingbacks are Off
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
For Sale: Seafire control module, remote display, control BobH260 General Classifieds (no boats) 0 28-08-2016 07:29
route following - bug or expected behavior? Maes OpenCPN 7 08-07-2016 18:54
[SOLD] Navico 5000 and 4000 wheel pilots and bits for parts or repair Wicks Classifieds Archive 1 11-06-2016 14:39
For Sale: Mediterranean Charts and Pilots monte Classifieds Archive 4 25-04-2014 11:59
route following philkoi OpenCPN 1 15-09-2013 12:11

Advertise Here
  Vendor Spotlight
No Threads to Display.


All times are GMT -7. The time now is 12:33.


Google+
Powered by vBulletin® Version 3.8.8 Beta 1
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Social Knowledge Networks
Powered by vBulletin® Version 3.8.8 Beta 1
Copyright ©2000 - 2024, vBulletin Solutions, Inc.

ShowCase vBulletin Plugins by Drive Thru Online, Inc.