Cruisers Forum
 


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 11-08-2022, 14:44   #511
Registered User

Join Date: Jul 2022
Posts: 4
Re: Watchdog Plugin

Unable to execute alarm via "command"

Hi,


Thanks for your feedback. Have been out sailing for a while but now I am back...
Still I have worked now and than on this issue.


First I need to clarify what I try to do:
I would like to publish the alarm (anchor as first target) via my old fashined electrical bell
driven by 9V and controlled via a switched regulator with the enable signal tied to one of the
RPI4 GPIO. Al this works as planned and the bell rings nicely when I pull the GPIO high.


To do this I have a small service script in perl that pulls the GPIO high for 15s and then low when executed. The scipt works for any user.


In watchdog I provide the full path to the script in the command box but so far I have failed to make it work.


Actually I have not managed to get any reaction regardless of what program I point to in the "command box". "aplay /full/path/to.wav" or any other combination does not work.
Since RPI and audio can be tricky I have also tested with other programs leaving traces in text files but no reslut.


I have been checking the Alarm.cpp in the sorce code and noticed that the plugin should complain if it can not launch the provided "command":


if(m_bCommand)
if(!wxProcess::Open(m_sCommand)) {
wxMessageDialog mdlg(GetOCPNCanvasWindow(),
Type() + " " +
_("Failed to execute command: ") + m_sCommand,
_("Watchdog"), wxOK | wxICON_ERROR);
mdlg.ShowModal();
m_bCommand = false;
}


I have not seen any "error messages" with one exception. At one time when I closed or opend opencpn I got the dialog (but not in conjunction with testing watchdog).


To test this further I install wxWidgets and wrote a small test program:


class Simple : public wxFrame
{
public:
Simple(const wxString& title)
: wxFrame(NULL, wxID_ANY, title, wxDefaultPosition, wxSize(250, 150))
{
Centre();
}
};

class MyApp : public wxApp
{
public:
bool OnInit()
{
Simple *simple = new Simple(wxT("Simple"));
simple->Show(true);

wxProcess::Open("/home/medin/ankartest.pl");

return true;
}
};

wxIMPLEMENT_APP(MyApp);



When I exeute this small test program it nicely calls my test script and I get the result I expect.




Further I have compiled watchdog locally hoping that I could test it and see if it works better than the version provided by the plugin manager but I could not figure out how to install it together with my flapack opencpn (that I need to use on my 64bit RPI OS).


So I am soewhat stuck... Seems things should work but they do not. Hard to tell if the problem is within opencpn, watchdog, raspberry OS (debian) or due to me.


Hopefully this long description will trigger some good ideas.


/Björn
bjmed is offline   Reply With Quote
Old 12-08-2022, 09:59   #512
Registered User

Join Date: Aug 2009
Location: oriental
Boat: crowther trimaran 33
Posts: 4,417
Re: Watchdog Plugin

Quote:
Originally Posted by bjmed View Post
Unable to execute alarm via "command"

Hi,


Thanks for your feedback. Have been out sailing for a while but now I am back...
Still I have worked now and than on this issue.


First I need to clarify what I try to do:
I would like to publish the alarm (anchor as first target) via my old fashined electrical bell
driven by 9V and controlled via a switched regulator with the enable signal tied to one of the
RPI4 GPIO. Al this works as planned and the bell rings nicely when I pull the GPIO high.


To do this I have a small service script in perl that pulls the GPIO high for 15s and then low when executed. The scipt works for any user.


In watchdog I provide the full path to the script in the command box but so far I have failed to make it work.


Actually I have not managed to get any reaction regardless of what program I point to in the "command box". "aplay /full/path/to.wav" or any other combination does not work.
Since RPI and audio can be tricky I have also tested with other programs leaving traces in text files but no reslut.


I have been checking the Alarm.cpp in the sorce code and noticed that the plugin should complain if it can not launch the provided "command":


if(m_bCommand)
if(!wxProcess::Open(m_sCommand)) {
wxMessageDialog mdlg(GetOCPNCanvasWindow(),
Type() + " " +
_("Failed to execute command: ") + m_sCommand,
_("Watchdog"), wxOK | wxICON_ERROR);
mdlg.ShowModal();
m_bCommand = false;
}


I have not seen any "error messages" with one exception. At one time when I closed or opend opencpn I got the dialog (but not in conjunction with testing watchdog).


To test this further I install wxWidgets and wrote a small test program:


class Simple : public wxFrame
{
public:
Simple(const wxString& title)
: wxFrame(NULL, wxID_ANY, title, wxDefaultPosition, wxSize(250, 150))
{
Centre();
}
};

class MyApp : public wxApp
{
public:
bool OnInit()
{
Simple *simple = new Simple(wxT("Simple"));
simple->Show(true);

wxProcess::Open("/home/medin/ankartest.pl");

return true;
}
};

wxIMPLEMENT_APP(MyApp);



When I exeute this small test program it nicely calls my test script and I get the result I expect.




Further I have compiled watchdog locally hoping that I could test it and see if it works better than the version provided by the plugin manager but I could not figure out how to install it together with my flapack opencpn (that I need to use on my 64bit RPI OS).


So I am soewhat stuck... Seems things should work but they do not. Hard to tell if the problem is within opencpn, watchdog, raspberry OS (debian) or due to me.


Hopefully this long description will trigger some good ideas.


/Björn
Is the alarm being triggered? Can you make it show a message box to test it?

Can you hack the plugin to call your fixed path script and see if it runs?

It is also possible to recompile wxwidgets in debugging mode and step into wxProcess::Open to determine.. but more likely the command being passed is wrong?
seandepagnier is offline   Reply With Quote
Old 12-08-2022, 13:54   #513
Registered User

Join Date: Jul 2022
Posts: 4
Re: Watchdog Plugin

Yes, the message box is enabled and showing when I get an alarm condition.


I could try to hack the plugin but must figure out how to install the plugin. If I manually put the plugin (.so) file into the opencpn directory structure opencpn crashes. Do I also need to compile opencpn to make the opencpn executable work with the compiled plugin library?


Before I try this I will (next week) test on my home computer that has the old fashioned apt based installation.
bjmed is offline   Reply With Quote
Old 13-08-2022, 03:56   #514
Registered User

Join Date: Aug 2009
Location: oriental
Boat: crowther trimaran 33
Posts: 4,417
Re: Watchdog Plugin

after compiling the plugin execute "sudo make install" then start opencpn and if everything is right it will use the newly compiled plugin
seandepagnier is offline   Reply With Quote
Old 27-08-2022, 16:23   #515
Registered User
 
rgleason's Avatar

Join Date: Mar 2012
Location: Boston, MA
Boat: 1981 Bristol 32 Sloop
Posts: 17,632
Images: 2
Re: Watchdog Plugin

Sean's and my repositories had diverged, as his had some pypilot alerts and he had renamed some files (signalk_client.h to pypilot_client.h) and mine was more current in other ways. I have tried to merge the two repositories and would like to have the result tested for its functions. This version may next need some help with wxformbuilder because I notice that some of the fields and menus are too restricted. The source is here

Watchdog 2.4.45.2 master-chg2sean -fix divergence in branch and add Pypilot.

Volunteer Testers,
We need to have watchdog_pi v2.4.45.2 Tested, particularly for the the new pypilot functions from Sean's repository.

Watchdog_pi v2.4.45.2 will be found in the PIM Beta directory once bdbcat merges my pull request and you update your Beta Catalog. Please post any issues in the Watchdog Thread or in the Test spreadsheet.
rgleason is offline   Reply With Quote
Old 01-09-2022, 13:39   #516
Registered User

Join Date: Jul 2022
Posts: 4
Re: Watchdog Plugin

Quote:
Originally Posted by bjmed View Post
Yes, the message box is enabled and showing when I get an alarm condition.


I could try to hack the plugin but must figure out how to install the plugin. If I manually put the plugin (.so) file into the opencpn directory structure opencpn crashes. Do I also need to compile opencpn to make the opencpn executable work with the compiled plugin library?


Before I try this I will (next week) test on my home computer that has the old fashioned apt based installation.

I have now tested the "command option" on my x86_64 computer with Ubuntu 22.04 and Opencpn 5.6.2 from .deb (normal distribution) and it works as expected (the command is executed when the alarm is triggered).


So it seems like I have problems with the aarch64 flatpak version.



Will try to build locally on my RPI4 aarch64 and see if it works better.


/Björn
bjmed is offline   Reply With Quote
Old 02-09-2022, 13:13   #517
Registered User
 
rgleason's Avatar

Join Date: Mar 2012
Location: Boston, MA
Boat: 1981 Bristol 32 Sloop
Posts: 17,632
Images: 2
Re: Watchdog Plugin

Once again, has anyone tested this beta version, please post your results.
I am particularly interested in testing of the Pypilot features!

I would like to be sure the Pypilot Alarms are working before I make a PR to Sean's repository!!!

BTW the only wxFormBuilder problem I've found is that
1. the Number of seconds field is not wide enough.
2. the Add new Alarm menu is too small.

These can be fixed easily.
Quote:
Watchdog 2.4.45.2 master-chg2sean -fix divergence in branch and add Pypilot.
Volunteer Testers,
We need to have watchdog_pi v2.4.45.2 Tested, particularly for the the new pypilot functions from Sean's repository.
Watchdog_pi v2.4.45.2 will be found in the PIM Beta directory once bdbcat merges my pull request and you update your Beta Catalog. Please post any issues in the Watchdog Thread or in the Test spreadsheet.
bjmed reports:

Quote:
I have now tested the "command option" on my x86_64 computer with Ubuntu 22.04 and Opencpn 5.6.2 from .deb (normal distribution) and it works as expected (the command is executed when the alarm is triggered).

So it seems like I have problems with the aarch64 flatpak version.

Will try to build locally on my RPI4 aarch64 and see if it works better.
I have no doubt that flatpak is a difficult customer, because the sound libraries have to be picked up and used by the flatpak installer as I (partially) understand it. Perhaps we have something mis-configured for flatpak, but perhaps your flatpak install does not find the required libraries?
rgleason is offline   Reply With Quote
Old 16-09-2022, 07:40   #518
Registered User

Join Date: May 2022
Location: Belgium
Boat: To come
Posts: 67
Re: Watchdog Plugin

Sorry for late answers.
Just back from long sailings.

Made my tests, all failing the same way.
Made the plugin installation and clicked on the icon.
Blank window.
Am I doing something wrong.
See results in shared google docs spreadsheet.
ALROCHARARI is offline   Reply With Quote
Old 16-09-2022, 07:53   #519
Registered User

Join Date: Jun 2017
Posts: 404
Re: Watchdog Plugin

Quote:
Originally Posted by ALROCHARARI View Post
Sorry for late answers.
Just back from long sailings.

Made my tests, all failing the same way.
Made the plugin installation and clicked on the icon.
Blank window.
Am I doing something wrong.
See results in shared google docs spreadsheet.


Then right click on blank window and add whatever alert you need
mgrouch is offline   Reply With Quote
Old 18-09-2022, 02:29   #520
Registered User

Join Date: May 2022
Location: Belgium
Boat: To come
Posts: 67
Re: Watchdog Plugin

Results of my tests:

On Raspberry PI 4 latest OS and latest patches:
Working fine but had some crashes when testing sounds.
OpenCPN completely crashing without explanations.

When checking log, discovered an error that I thought initially related to Watchdog but uninstalled all plugins except o-charts and error still there.

Can you help me to fix this first?
Please find attached opencpn.conf & opencpn.log

Thanks for help.

opencpn.conf.doc

opencpn.log.doc
ALROCHARARI is offline   Reply With Quote
Old 18-09-2022, 04:38   #521
Registered User

Join Date: May 2022
Location: Belgium
Boat: To come
Posts: 67
Re: Watchdog Plugin

When selecting a sound file for the alarm, next time I come in the edit window, the file selected is not listed anymore but seems still to be attached to this alarm. Test confirm it.
ALROCHARARI is offline   Reply With Quote
Old 18-09-2022, 16:30   #522
Registered User
 
rgleason's Avatar

Join Date: Mar 2012
Location: Boston, MA
Boat: 1981 Bristol 32 Sloop
Posts: 17,632
Images: 2
Re: Watchdog Plugin

Your log file


Quote:
11:03:28.729 MESSAGE pluginmanager.cpp:1168 Checking plugin candidate: /home/pi/.var/app/org.opencpn.OpenCPN/lib/opencpn/libo-charts_pi.so
11:03:28.729 ERROR pluginmanager.cpp:1984 Could not open file "opencpn" for reading with errno = 2.
11:03:28.729 MESSAGE pluginmanager.cpp:2225 Plugin is compatible by elf library scan: true
11:03:28.729 MESSAGE pluginmanager.cpp:2364 PlugInManager: Loading PlugIn: /home/pi/.var/app/org.opencpn.OpenCPN/lib/opencpn/libo-charts_pi.so

and further
Quote:
11:03:29.190 MESSAGE OCPNPlatform.cpp:1033 ChangeLocale: Language load for: fr_BE
11:03:29.194 MESSAGE OCPNPlatform.cpp:1043 Using flatpak locales at /home/pi/.var/app/org.opencpn.OpenCPN/data/locale
11:03:29.206 MESSAGE OCPNPlatform.cpp:1086 ChangeLocale: Locale Init OK for: fr_BE
11:03:29.206 MESSAGE OCPNPlatform.cpp:1101 ERROR Loading translation catalog for: opencpn-o-charts_pi
11:03:29.206 MESSAGE OCPNPlatform.cpp:1111 Loading catalog for opencpn core.
11:03:29.217 MESSAGE OCPNPlatform.cpp:952 Getting DefaultSystemLocale...
11:03:29.217 MESSAGE pluginmanager.cpp:1091 Loading plugins from dir: /app/extensions/lib/opencpn
11:03:29.217 MESSAGE pluginmanager.cpp:1121 PlugInManager searching for PlugIns in location /app/extensions/lib/opencpn
11:03:29.217 MESSAGE pluginmanager.cpp:1135 Directory /app/extensions/lib/opencpn does not exist.
11:03:29.217 MESSAGE pluginmanager.cpp:1091 Loading plugins from dir: /app/lib/opencpn
11:03:29.217 MESSAGE pluginmanager.cpp:1121 PlugInManager searching for PlugIns in location /app/lib/opencpn
11:03:29.217 MESSAGE pluginmanager.cpp:1159 Found 4 candidates

Looks to me like the french translation catalog is not available for o-charts.
rgleason is offline   Reply With Quote
Old 19-09-2022, 07:18   #523
Registered User

Join Date: May 2022
Location: Belgium
Boat: To come
Posts: 67
Re: Watchdog Plugin

How can I fix this?
ALROCHARARI is offline   Reply With Quote
Old 19-09-2022, 07:55   #524
Registered User
 
rgleason's Avatar

Join Date: Mar 2012
Location: Boston, MA
Boat: 1981 Bristol 32 Sloop
Posts: 17,632
Images: 2
Re: Watchdog Plugin

I think you should ask O-charts or Dave about it. Dave is pretty darn busy right now, so best to ask O-charts.
rgleason is offline   Reply With Quote
Old 22-09-2022, 11:58   #525
Registered User

Join Date: May 2022
Location: Belgium
Boat: To come
Posts: 67
Re: Watchdog Plugin

Quote:
Originally Posted by rgleason View Post
I think you should ask O-charts or Dave about it. Dave is pretty darn busy right now, so best to ask O-charts.
I contacted O-Charts guy which was very quick to answer and very friendly.

Conclusions are that I have 2 errors. One linked to translation, one appearing when a plugin or more are loaded. None linked to o-charts.

Explanations:

OpenCPN is installed with Flatpak on Raspberry PI 4 8Gb 64 bits OS Bullseye with Openplotter.

Error 1
Linked to OpenCPN issue:
With plugins, I have ERROR pluginmanager.cpp.1984 Could not open file "opencpn" for reading with errno = 2.
When I disable the O-Charts Plugin, the issue is still there.
When I disable all the plugins, the issue is gone.
When I install wmm, the issue is back.
When I remove wmm, the issue is gone.
When I install grib , the issue is back.
So the problem is not linked to o-charts but to plugin(s) activation.
No clue how to solve or where this is coming from.

Error 2
Linked to translation issue:
I observe that OpenCPN is translated in french but not the plugins...
So when checking language, I have "French(Belgian)" not translating plugins but well OpenCPN.
When I select "Français", everything is correctly translated and I don't have this error anymore except for 1 plugin: Logbook
Can this be solved somewhere?
I agree that "Français" and French(Belgian)" are the same words and sentences but we could still have some differences. For all translations, we should have this aligned.

Thanks in advance for your help and again sorry to post this here.
ALROCHARARI is offline   Reply With Quote
Reply

Tags
plug


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
Plugin: DashBoard SethDart OpenCPN 644 02-04-2024 16:55
OpenCPN PlugIn Development bdbcat OpenCPN 161 04-09-2019 12:50
UncleMag Intro - Watchdog for World Cruisers ! UncleMag Meets & Greets 4 03-02-2011 00:47
Florida to Bahamas Watchdog countrybimm Atlantic & the Caribbean 54 20-04-2010 15:50

Advertise Here


All times are GMT -7. The time now is 22:03.


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.