Open wright opened 2 years ago
Is there a known cause for this?
Yes ... OpenCPN 5.6 on the Mac uses wxWidgets-3.1.5. Have you used this plugin successfully in the past? If so I will make a release version and put it in the catalog.
No, this is the first time I have tried both OpenCPN and this plugin. So, SailawayNMEA-Plugin_0.2 is compatible with an older version of OpenCPN? (e.g., 5.2.4?)
I just checked, and SailawayNMEA-Plugin_0.2 is compatible with OpenCPN 5.2.4. Maybe it would be a good idea to make a new version for the newer OpenCPN. It does not show up in the catalog in OpenCPN 5.6.0.
Is it worth it?
I don't know. I have just started trying to use it.
I am still trying to get SailawayNMEA-Plugin_0.2 working with OpenCPN 5.2.4. The plugin shows up, is enabled, and can bring up the SailawayNMEA configuration. I have the UDP port 57343 connection set up in OpenCPN. However, when I click on "Load Boats" in the SailawayNMEA configuration dialog, nothing happens. I have tried both my Sailaway email and nickname in the SailawayNMEA "User name" dialog box. Any suggestions?
No NMEA feed myself tonight. I will look at this tomorrow.
No luck here. But the app that this plugin is based on does work and allows a connection:
You may want to try using this program: https://github.com/expilu/sailaway-api-to-nmea
I will try to find out where the issue is with the plugin.
Ted ... Thanks for raising this one. I have updated the code. Now making some Cloudsmith repos. When I have a tarball that works on the Mac I will advise the URL for a download.
I tried sailaway-api-to-nmea, and it works with my Sailaway nickname. However, I don't normally have a Windows computer around to run it, so I like the idea of this OpenCPN plugin that runs on Macs.
If you are building a new version, please consider updating to OpenCPN 5.6.0 compatibility. Most of the other OpenCPN plugins are only available for the newer version.
A Mac tarball for OpenCPN 5.6.0 is here: https://cloudsmith.io/~mike-rossiter/repos/sailawaynmea-alpha/packages/detail/raw/SailawayNMEA-0.4-darwin-wx315-10.13.6-tarball/0.4.0+268.0f897ba/ Working on my Mac Mini (Catalan). Could you give it a test?
I tried this with a fresh installation of OpenCPN 5.6.0. I assume that I am supposed to "Import plugin" and select the tarball (at least that makes some progress):
Importing the plugin, I see this in the log:
07:55:33.732 MESSAGE PluginHandler.cpp:159 Plugin: setting up, name: SailawayNMEA
07:55:33.747 MESSAGE pluginmanager.cpp:5387 Copied /Users/wright/Downloads/SailawayNMEA-0.4.0+268.0f897ba_darwin-wx315-10.13.6-x86_64.tar.gz to local cache
07:55:33.766 MESSAGE PluginHandler.cpp:159 Plugin: setting up, name: SailawayNMEA
Clicking on the imported plugin to install it, I see this in the log:
07:58:29.451 MESSAGE PluginHandler.cpp:693 Installing SailawayNMEA-0.4-darwin-wx315-10.13.6/OpenCPN.app/Contents/PlugIns/ into /Users/wright/Library/Application Support/OpenCPN/Contents/PlugIns/
Clicking on the SailawayNMEA icon to open it, I see this in the log:
08:00:47.947 ERROR ffile.cpp:57 can't open file '/Applications/OpenCPN.app/Contents/SharedSupport/plugins/SailawayNMEA_pi/data/blank.ico' (error 2: No such file or directory)
08:00:47.947 ERROR image.cpp:2688 Failed to load image from file "/Applications/OpenCPN.app/Contents/SharedSupport/plugins/SailawayNMEA_pi/data/blank.ico".
Note: this file does exists at: /Users/wright/Library/Application Support/OpenCPN/Contents/SharedSupport/plugins/SailawayNMEA_pi/data/blank.ico
After this, the SailawayNMEA dialog opens and no further log messages appear. I enter my user name, and the "Load Boats" button works; the boat field is populated. I click start server: A dialog box pops up with the OpenCPN logo that says " Message Error" and an OK button. I press OK and a dialog box opens with the OpenCPN logo that says " Message Starting NMEA feed" and an OK button. I press OK and OpenCPN crashes
@wright :Thanks. I will take a look. We don't need blank.ico.
Build 278(Mac) is now in Cloudsmith. https://cloudsmith.io/~mike-rossiter/repos/sailawaynmea-alpha/packages/detail/raw/SailawayNMEA-0.4-darwin-wx315-10.13.6-tarball/0.4.0+278.bad2c2b/
Suggest uninstalling the previous build. You may also need to remove the libSailawayNMEA_pi.dylib plugin file if uninstalling has not removed it..
I uninstalled, and installed the new version.
I did not see any errors in the log, but runtime behavior was the same. "Load Boats" worked, but "Start Server" pops up the two dialog boxes and OpenCPN crashes without writing anything to the log.
Is this with the two connections set up/ticked in OpenCPN: TCP port 10110 and UDP port 57343?
You may also need to remove the libSailawayNMEA_pi.dylib plugin file
Had to do this to stop crashes at one point.
I was missing the TCP port, but have the same behavior after adding it. libSailawayNMEA_pi.dylib was removed when I did the uninstall. I just deleted everything (both the OpenCPN.app and the directory in Application Support) and reinstalled from scratch, and it is still crashing.
Thanks for sticking with it. Not sure where to take this. I had a number of crashes. Deleted the plugin totally and then opened and closed OpenCPN a couple of times to get rid of the warning about a crash "Do you want to run in safe mode?". Why it retained that warning I don't know but after a new install it worked on the Mac here. I will do some more digging.
Icon making was experimental. Reverted to known method used in working plugins. Installs fine on Windows and MacOS. I have cleaned up the builds and Cloudsmith so that only MSVC and MacOS builds are made. Sailaway app only runs on these two OS.
I am still getting the blank Error dialog and crash with build 292 on MacOS.
I have not tried it yet, but OpenCPN runs on Android tablets, and it might be useful to run that along side Sailaway (I assume a Network Address would need to be changed in the OpenCPN connections dialog?). I think there is a use case for more builds.
And this is with all the previous dylib and SailawayNMEA plugin stuff removed?
I think there is a use case for more builds
But Sailaway only runs on MacOS and MSVC?
Yes, I deleted OpenCPN and its Application Support directory, and reinstalled from scratch with build 292.
OpenCPN (and this plugin) can run on a different device/display and get data from Sailaway. Doesn't the Sailaway data actually come from the Sailaway web server? So OpenCPN and SailawayNMEA should work even when Sailaway is not running locally (for instance, when there is an "offline" boat in Sailaway and the server is updating its position).
should work even when Sailaway is not running locally
You are correct. But I need to get this running on the Mac first! Compiled my own tarball locally and again no problems for me. What version of MacOS are you running?
I'm running 10.14.6. I agree that restricting the number of builds until it is working is a good idea.
I'm seeing this in the OSX crash report:
Crashed Thread: 0 Dispatch queue: com.apple.main-thread
Exception Type: EXC_BAD_ACCESS (SIGSEGV)
Exception Codes: KERN_INVALID_ADDRESS at 0x0000000000000048
Exception Note: EXC_CORPSE_NOTIFY
Termination Signal: Segmentation fault: 11
Termination Reason: Namespace SIGNAL, Code 0xb
Terminating Process: exc handler [7691]
VM Regions Near 0x48:
-->
__TEXT 000000010fc0f000-000000011054b000 [ 9456K] r-x/r-x SM=COW /Applications/OpenCPN.app/Contents/MacOS/OpenCPN
Thread 0 Crashed:: Dispatch queue: com.apple.main-thread
0 libwx_baseu_net-3.1.5.0.0.dylib 0x0000000110c5dc68 wxSocketBase::LastError() const + 8
1 libSailawayNMEA_pi.dylib 0x000000011870235b Dlg::Init_Datagram_Socket() + 475
2 libSailawayNMEA_pi.dylib 0x00000001187020d0 Dlg::OnStartServer(wxCommandEvent&) + 64
3 libwx_baseu-3.1.5.0.0.dylib 0x000000011159a67e wxEvtHandler::SearchDynamicEventTable(wxEvent&) + 222
...
Thanks. That was useful. https://developer.apple.com/documentation/network/ipv4address I have changed the deployment target to 10.14 (Mojave). Also Sailaway has asked for a slow download of data (10 minute interval) to avoid overloading the webserver. New builds have been made. MacOS is now #293.
I'm still getting the crash with version 293.
I think the empty Error dialog just before the crash is coming from line 792 of src/SailawayNMEAgui_impl.cpp. If so, it is due to wxGetFullHostName() failing. I'm not sure why that would fail (or why the host name is necessary).
MacOS #294 has a lot of stuff removed around wxGetFullHostName(). On Windows I get an intermittent feed from Sailaway but that can be sorted later, if there is no crash on the Mac.
No ... crashes on Catalan.
I'm still getting the same crash, with the same traceback, but without the empty Error dialog.
Are you sure these two lines are necessary:
m_LocalAddress.Hostname(wxGetFullHostName() );
// if(!success) wxMessageBox(wxT("Error"));
wxString ipAddress = m_LocalAddress.IPAddress();
They seem redundant with:
m_LocalAddress.AnyAddress();
ipAddress does not seem to be used. I will try removing it.
m_LocalAddress.Hostname(wxGetFullHostName() );
And me. Added m_LocalAddress.Hostname(wxGetFullHostName() ) again. This function relies on the include wx/utils.h which was not included in the code. It is now. Another build on the way.
I might be confused because I am not set up to actually try to compile this code, but doesn't SailawayNMEA only send on the UDP socket? If so, I don't think it needs to know the local IP address, and the network code could be simpler. Maybe something like this:
// setup socket
wxIPV4address m_LocalAddress;
m_LocalAddress.AnyAddress(); // 0.0.0.0
wxDatagramSocket socketOut = new wxDatagramSocket(m_LocalAddress, wxSOCKET_BROADCAST | wxSOCKET_NOBIND);
wxIPV4address ipBroadcastAddress;
ipBroadcastAddress.BroadcastAddress(); // 255.255.255.255
ipBroadcastAddress.Service(PORT);
// then to send:
socketOut->SendTo(ipBroadcastAddress, message.data(), strlen(message.data()));
Thanks. Now only using send on the UDP.
I think you need 2 different wxIPV4address structures. One for the local address used in wxDatagramSocket to create the socket, and one for the broadcast address used in SendTo. It looks like you are using the same structure in both calls.
I think you need 2 different wxIPV4address structures
Done. #300
On the Mac, if you have a compiler and bash you can make a tarball using the script: ./ci/circleci-build-macos.h First stage builds into the os-x directory. From there "make tarball"
@wright :+1: Thanks for your help.
You are welcome. Let me know if there is anything else you would like me to test on a Mac.
I hate to mention it, but I am seeing a problem with the dead reckoning position. The new calculated position looks as if it is based on a speed about 5 times too high.
The speed as read from Sailaway is correct (although you should probably use groundSpeed instead of waterSpeed for getting the new position). I'm not sure what this line is trying to do:
double spd = (drBoat.waterSpeed)/60/6; // to change later to allow for download interval
The spd variable is passed in destLoxodrome as a distance. Maybe it is assuming an inaccurate update rate? I will run some more tests.
:( Having another look!
Original DR interval was 10 secs. I found the boat lost position and reduced the interval to 1 sec. Now back at 10 sec and using groundSpeed. Strictly DR is waterSpeed but I agree that groundSpeed will better position the boat for the next upload from Sailaway.
I installed #306, and gave it a very brief test. It looks to me like the DR updates are actually happening about every 1.9 seconds on my computer.
It might be more accurate to calculate the distance based on groundSpeed times time since the last real data retrieval, and offset that distance from the last position at the last data retrieval. That should accumulate fewer errors if the data update timing is not exactly right.
Speed now seems to match Sailaway. I am only updating from Sailaway every 10 minutes as discussed before. Stopping the server and starting again provides a quick check of speeds.
Hello,
I am getting this error in the OpenCPN 5.6.0 log after running SailawayNMEA-Plugin_0.2.pkg:
Is there a known cause for this? Thanks.