|
|
25-05-2018, 23:38
|
#1
|
Registered User
Join Date: Jul 2015
Posts: 5
|
How to activate a hardware alarm on AIS event
Hello,
I have OpenPlotter and OpenCPN installed on my RPi.
I also have dAISy hat and it works just fine. I have built a small hardware piezo siren connected to one of the Pi GPIO.
My question is - how is it possible to make OpenCPN create an event based on some AIS event (e.g. AIS CPA alarm) that can be sent to Signal K server so I can then use OpenPlotter to create an action on my GPIO and sound the alarm?
Or maybe there's another way to do that?
Thanks
Eugeni
|
|
|
26-05-2018, 03:38
|
#2
|
Registered User
Join Date: Feb 2010
Location: Tierra del Fuego
Boat: Phantom 19
Posts: 6,145
|
Re: How to activate a hardware alarm on AIS event
Quote:
Originally Posted by emanahov
Hello,
I have OpenPlotter and OpenCPN installed on my RPi.
I also have dAISy hat and it works just fine. I have built a small hardware piezo siren connected to one of the Pi GPIO.
My question is - how is it possible to make OpenCPN create an event based on some AIS event (e.g. AIS CPA alarm) that can be sent to Signal K server so I can then use OpenPlotter to create an action on my GPIO and sound the alarm?
Or maybe there's another way to do that?
Thanks
Eugeni
|
Eugeni...
There is no out of the box way to do it. But you can sure patch the source to invoke an external program doing what you need. It will be one line of code (two if you also want it to turn off the siren once the alarm is dismissed)...
Pavel
|
|
|
26-05-2018, 04:05
|
#3
|
cruiser
Join Date: Nov 2007
Location: Probably in an anchorage or a boatyard..
Boat: Ebbtide 33' steel cutter
Posts: 5,030
|
Re: How to activate a hardware alarm on AIS event
If anyone knows a command line ais message decoder for linux then it would be pretty easy to do something in node-red maybe based on distance from GPS position.
|
|
|
26-05-2018, 04:21
|
#4
|
Registered User
Join Date: Jul 2015
Posts: 5
|
Re: How to activate a hardware alarm on AIS event
Quote:
Originally Posted by nohal
Eugeni...
There is no out of the box way to do it. But you can sure patch the source to invoke an external program doing what you need. It will be one line of code (two if you also want it to turn off the siren once the alarm is dismissed)...
Pavel
|
Dear Pavel,
Thanks for your fast reply. Do you mean for me to patch the OpenCPN sources in order to do that?
Thanks
Eugeni
|
|
|
26-05-2018, 04:22
|
#5
|
Registered User
Join Date: Jul 2015
Posts: 5
|
Re: How to activate a hardware alarm on AIS event
Quote:
Originally Posted by conachair
If anyone knows a command line ais message decoder for linux then it would be pretty easy to do something in node-red maybe based on distance from GPS position.
|
Dear conachair,
Yes, I have contacted the producer of the dAISy hat to ask him to help me with similar task.
Thanks
Eugeni
|
|
|
26-05-2018, 04:28
|
#6
|
Registered User
Join Date: Feb 2010
Location: Tierra del Fuego
Boat: Phantom 19
Posts: 6,145
|
Re: How to activate a hardware alarm on AIS event
Quote:
Originally Posted by emanahov
Dear Pavel,
Thanks for your fast reply. Do you mean for me to patch the OpenCPN sources in order to do that?
Thanks
Eugeni
|
Yes, I mean for you to add either 1 or 2 lines of code to OpenCPN sources in order to do that.
|
|
|
26-05-2018, 05:15
|
#7
|
Registered User
Join Date: Jul 2015
Posts: 5
|
Re: How to activate a hardware alarm on AIS event
Quote:
Originally Posted by nohal
Yes, I mean for you to add either 1 or 2 lines of code to OpenCPN sources in order to do that.
|
You're right. I have found the function where I can do that (I think).
It should be this?
void AIS_Decoder::UpdateAllAlarms( void )
in scr/AIS_Decoder.cpp
While we're on the subject, please tell me if I need to upload the modified source later (after I test it)? I am asking because I use other people's work here and want to be fully OK with the community.
Thanks
Eugeni
|
|
|
26-05-2018, 05:36
|
#8
|
Registered User
Join Date: Feb 2010
Location: Tierra del Fuego
Boat: Phantom 19
Posts: 6,145
|
Re: How to activate a hardware alarm on AIS event
Quote:
Originally Posted by emanahov
You're right. I have found the function where I can do that (I think).
It should be this?
void AIS_Decoder::UpdateAllAlarms( void )
in scr/AIS_Decoder.cpp
|
Maybe I would prefer to do it in AIS_Decoder::OnTimerAIS (Which anyway calls UpdateAllAlarms), but haven't looked very closely.
Quote:
While we're on the subject, please tell me if I need to upload the modified source later (after I test it)? I am asking because I use other people's work here and want to be fully OK with the community.
Thanks
Eugeni
|
You don't *need* to unless you distribute your "product" to others, then you would be required to give them your modified source by the GPL license.
But it is kind of good manners to fork the OpenCPN repository on github and publish your changes there.
Pavel
|
|
|
26-05-2018, 05:52
|
#9
|
cruiser
Join Date: Nov 2007
Location: Probably in an anchorage or a boatyard..
Boat: Ebbtide 33' steel cutter
Posts: 5,030
|
Re: How to activate a hardware alarm on AIS event
Would it be a big deal to program in an option to send , say, an nmea XDR message when the AIS alarm gets triggered?
Enough interest to add as a feature request?
Could be handy for the many Rasp P users to trigger an external alarm/buzzer.
|
|
|
26-05-2018, 05:57
|
#10
|
Registered User
Join Date: Feb 2010
Location: Tierra del Fuego
Boat: Phantom 19
Posts: 6,145
|
Re: How to activate a hardware alarm on AIS event
Quote:
Originally Posted by conachair
Would it be a big deal to program in an option to send , say, an nmea XDR message when the AIS alarm gets triggered?
Enough interest to add as a feature request?
Could be handy for the many Rasp P users to trigger an external alarm/buzzer.
|
No, it would not be a big deal. It would also not be a big deal to implement sending an internal event message and extend the launcher plugin to let you do whatever based on that event. I will gladly review and merge pull requests implementing it...
|
|
|
26-05-2018, 06:23
|
#11
|
cruiser
Join Date: Nov 2007
Location: Probably in an anchorage or a boatyard..
Boat: Ebbtide 33' steel cutter
Posts: 5,030
|
Re: How to activate a hardware alarm on AIS event
Quote:
Originally Posted by nohal
No, it would not be a big deal. It would also not be a big deal to implement sending an internal event message and extend the launcher plugin to let you do whatever based on that event. I will gladly review and merge pull requests implementing it...
|
Launcer looks great, never looked at it before - an event sent there would be great
|
|
|
26-05-2018, 19:16
|
#12
|
Registered User
Join Date: Dec 2011
Boat: Blue Buoy Del Rey 50
Posts: 206
|
Re: How to activate a hardware alarm on AIS event
Cant you do something with the watchdog plugin?
|
|
|
26-05-2018, 21:13
|
#13
|
Registered User
Join Date: Feb 2010
Location: Tierra del Fuego
Boat: Phantom 19
Posts: 6,145
|
Re: How to activate a hardware alarm on AIS event
Quote:
Originally Posted by deepthought
Cant you do something with the watchdog plugin?
|
Something yes, but not what the OP needs as the watchdog currently does not implement alarm for CPA of an AIS target.
|
|
|
27-05-2018, 15:14
|
#14
|
Registered User
Join Date: Mar 2012
Location: Boston, MA
Boat: 1981 Bristol 32 Sloop
Posts: 17,494
|
Re: How to activate a hardware alarm on AIS event
|
|
|
30-05-2018, 04:59
|
#15
|
Registered User
Join Date: Aug 2009
Location: oriental
Boat: crowther trimaran 33
Posts: 4,414
|
Re: How to activate a hardware alarm on AIS event
There is ais alarm in the watchdog plugin, but maybe not for CPA. You could just implement it there, since running an external command is already supported.
You might not need to send a signalk message. you could just run the gpio program, it depends on exactly what you want.
|
|
|
|
|
Thread Tools |
Search this Thread |
|
|
Display Modes |
Rate This Thread |
Linear Mode
|
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
|
Advertise Here
Recent Discussions |
|
|
|
|
|
|
|
|
|
|
|
|
Vendor Spotlight |
|
|
|