Cruisers Forum
 


Reply
 
Thread Tools Search this Thread Rate Thread Display Modes
Old 18-02-2017, 06:56   #1156
Registered User

Join Date: Nov 2012
Location: Orust Sweden
Boat: Najad 34
Posts: 4,112
Re: Help / FAQ

cgreen..
Easy!
You've to learn to let a bat file write into a text file. Let that bat file run as a message in Watchdog when a alarm occurs.
A small bat-file example:

rem File "c:\logs\PrintLog.bat"
@echo off
echo date /T >> c:\logs\mylog.txt
echo time /T >> c:\logs\mylog.txt
echo Watchdog Alarm NoGo35 >> c:\logs\mylog.txt
echo: >> c:\logs\mylog.txt

Google is a good friend, like this to explain my example: https://www.google.se/search?q=bat+f...L_Lk8Af4u4-gBg

Håkan
Hakan is online now   Reply With Quote
Old 18-02-2017, 08:06   #1157
Registered User

Join Date: Jan 2017
Posts: 23
Re: Help / FAQ

Quote:
Originally Posted by Hakan View Post
cgreen..
Easy!
You've to learn to let a bat file write into a text file. Let that bat file run as a message in Watchdog when a alarm occurs.
A small bat-file example:

rem File "c:\logs\PrintLog.bat"
@echo off
echo date /T >> c:\logs\mylog.txt
echo time /T >> c:\logs\mylog.txt
echo Watchdog Alarm NoGo35 >> c:\logs\mylog.txt
echo: >> c:\logs\mylog.txt

Google is a good friend, like this to explain my example: https://www.google.se/search?q=bat+f...L_Lk8Af4u4-gBg

Håkan
Thanks Hakan, but does opencpn publish the name of the boundary that you are currently entering? I know that opencpn identifies the boundary name because it displays it in the alarm message box. Just wondering if that name is also available outside of the program to log somewhere. Easiest way it seems to me would be to have a similar option to the message box, and instead of displaying the alarm, simply append a log file in similar fashion that you describe, except from inside opencpn. Cheers, Chris
cgreen is offline   Reply With Quote
Old 18-02-2017, 09:17   #1158
Registered User

Join Date: Nov 2012
Location: Orust Sweden
Boat: Najad 34
Posts: 4,112
Re: Help / FAQ

Chris
For each Watchdog alarm you create you can attache a bat file command, see attache shoot.
You've to create the bat file to print whatever text you like to the text file. My example, with the "NoGo35", was referring to your text above.
But OCPN and a WD alarm has to be the one to trig the Windows bat file to run and print the log text. Or what do mean with "outside OCPN"
Håkan
Attached Thumbnails
Click image for larger version

Name:	WD_bat.PNG
Views:	59
Size:	8.0 KB
ID:	141509  
Hakan is online now   Reply With Quote
Old 18-02-2017, 13:10   #1159
Registered User

Join Date: Nov 2012
Location: Orust Sweden
Boat: Najad 34
Posts: 4,112
Re: Help / FAQ

Chris
Sorry, my example was a bit hasty.
This works better:

rem File "c:\logs\PrintLog.bat"
@echo off
date /T >> c:\logs\mylog.txt
time /T >> c:\logs\mylog.txt
echo Watchdog Alarm NoGo35 >> c:\logs\mylog.txt
echo: >> c:\logs\mylog.txt

Håkan
Hakan is online now   Reply With Quote
Old 18-02-2017, 14:34   #1160
Registered User

Join Date: Jan 2017
Posts: 23
Re: Help / FAQ

Quote:
Originally Posted by Hakan View Post
Chris
For each Watchdog alarm you create you can attache a bat file command, see attache shoot.
You've to create the bat file to print whatever text you like to the text file. My example, with the "NoGo35", was referring to your text above.
But OCPN and a WD alarm has to be the one to trig the Windows bat file to run and print the log text. Or what do mean with "outside OCPN"
Håkan
Thanks very much for the explanation Hakan. I can do as you say with bat file, or similar with a python script. That makes sense. I am trying to do something a bit unusual. I had defined a number of OD Points (buoys) in the Watchdog Path & Point Manager, and I had setup a single boundary exclusion alarm to trigger whenever I enter any of the multiple exclusions that are defined. This works great, and triggers alarm whenever entering any of the exclusions, and watchdog displays the name of the exclusion that has been entered. I am wondering if I can grab that exclusion (OD Point) name, and log it?
cgreen is offline   Reply With Quote
Old 19-02-2017, 00:14   #1161
Registered User

Join Date: Nov 2012
Location: Orust Sweden
Boat: Najad 34
Posts: 4,112
Re: Help / FAQ

Chris
No I can't figure out any method for Windows to catch the GUID causing an alarm. I suppose it has to be coded in WD as a new plugin function. So a Flyspray task for a log print function may be the method for this as Rick mentioned. Why not prepared by a discussion at the Watchdog thread?
Håkan
Hakan is online now   Reply With Quote
Old 19-02-2017, 06:48   #1162
Registered User

Join Date: Nov 2012
Location: Orust Sweden
Boat: Najad 34
Posts: 4,112
Re: Help / FAQ

Chris...more
One thought:
Meanwhile it's actually possible to make as many WD inclusion alarms you want. One for each object you want to guard. And of course one bat-file printing different text for each alarm. All bat files can though print to same text/log file if you want.
Håkan
Hakan is online now   Reply With Quote
Old 19-02-2017, 07:04   #1163
Registered User

Join Date: Jan 2017
Posts: 23
Re: Help / FAQ

Quote:
Originally Posted by Hakan View Post
Chris...more
One thought:
Meanwhile it's actually possible to make as many WD inclusion alarms you want. One for each object you want to guard. And of course one bat-file printing different text for each alarm. All bat files can though print to same text/log file if you want.
Håkan
Yes, I have been experimenting with that too, but I always run into trouble with WD warning that GUID does not exist, even when I copy and paste it from an existing OD point. Not sure if inclusion alarm is going to work, because I want the alarm to trigger when I enter the boundary circle, not when I exit it. For now though, I need to figure out why WD doesn't like any GUID that I enter; it is no doubt something I am doing wrong. Chris
cgreen is offline   Reply With Quote
Old 20-02-2017, 01:14   #1164
Registered User

Join Date: Nov 2012
Location: Orust Sweden
Boat: Najad 34
Posts: 4,112
Re: Help / FAQ

Chris
I tried and I agree to your experiences.
I did:
> Made a boundary in OD, exclusion to get inside guard area.
> Copied the GUID to clipboard by the right click menu. Pict 1
> Set up a inclusion alarm. Paste the copied GUID from clipboard and attached a bat file. Pict 2
> Works and was also printing to the log. Pict 3. But this is basically an anchor alarm so it's set to alarm when outside the boundary.

What you need is an opposite function. May be called "Exclusion Alarm"
The function would be to alarm if own ship is entered into a specific GUID. That's apart from the "GPS course crosses boundary in......" which is a general guard for all boundary GUID.

Maybe you would create a new Watchdog thread and refer to this to see if Jon or Sean has additional comments.
Håkan
Attached Thumbnails
Click image for larger version

Name:	WD_GUID.PNG
Views:	80
Size:	72.1 KB
ID:	141626   Click image for larger version

Name:	WD_conf.PNG
Views:	58
Size:	14.0 KB
ID:	141627  

Click image for larger version

Name:	WD_inside.PNG
Views:	66
Size:	120.2 KB
ID:	141628  
Hakan is online now   Reply With Quote
Old 23-02-2017, 11:38   #1165
Registered User

Join Date: Jan 2017
Posts: 23
Re: Help / FAQ

Is there any way to force opencpn to re-read (and update map with) either


C:\ProgramData\opencpn\navobj.xml.changes
or
C:\ProgramData\opencpn\plugins\ocpn_draw_pi\data\O Dnavobj.xml.changes


without restarting opencpn?
cgreen is offline   Reply With Quote
Old 23-02-2017, 17:13   #1166
Registered User
 
transmitterdan's Avatar

Join Date: Oct 2011
Boat: Valiant 42
Posts: 6,008
Re: Help / FAQ

I don't think restarting O re-reads charts. Look at Options->Charts for the rebuild or rescan selection.
transmitterdan is offline   Reply With Quote
Old 24-02-2017, 05:25   #1167
Registered User

Join Date: Feb 2010
Location: Tierra del Fuego
Boat: Phantom 19
Posts: 6,145
Re: Help / FAQ

cgreen...
What exactly do you intend to achieve?
The .changes files temporarily store changes in the navigation objects (waypoints, routes, tracks etc.) before they are persisted in the main data files (for performance reasons it is not possible to save the possibly huge data file every time there is a change) and their purpose is to prevent data loss in case OpenCPN is killed between the full saves due to a bug or power outage or whatever else reason. They have nothing to do with maps (charts).
The same concept is copied in the draw plugin.
But to generally answer your question: You can't modify OpenCPN's "live" data files outside of OpenCPN while the program is running without causing a major disaster or at least having your external changes lost at any moment when OpenCPN itself saves it's data.

Pavel
nohal is offline   Reply With Quote
Old 24-02-2017, 11:12   #1168
Registered User

Join Date: Jan 2017
Posts: 23
Re: Help / FAQ

Quote:
Originally Posted by nohal View Post
cgreen...
What exactly do you intend to achieve?
The .changes files temporarily store changes in the navigation objects (waypoints, routes, tracks etc.) before they are persisted in the main data files (for performance reasons it is not possible to save the possibly huge data file every time there is a change) and their purpose is to prevent data loss in case OpenCPN is killed between the full saves due to a bug or power outage or whatever else reason. They have nothing to do with maps (charts).
The same concept is copied in the draw plugin.
But to generally answer your question: You can't modify OpenCPN's "live" data files outside of OpenCPN while the program is running without causing a major disaster or at least having your external changes lost at any moment when OpenCPN itself saves it's data.

Pavel
Thanks, that what I suspected, but thought I had better check. When I say map, I don't mean anything to do with charts. I just mean the active display that shows vessel position and waypoints etc. My only reason for asking about the .changes files was to try and figure out a way to get new points (waypoints, or in fact any kind of a point) onto the display while opencpn is running, and without actually drawing them and entering details. My next thought was that I could send $GPWPL waypoint messages to opencpn via a virtual com port. However, I don't think opencpn does anything with those messages. Not sure if there is some other method to mark positions on the active display while program is running?

Cheers, Chris
cgreen is offline   Reply With Quote
Old 24-02-2017, 11:32   #1169
Registered User

Join Date: Feb 2010
Location: Tierra del Fuego
Boat: Phantom 19
Posts: 6,145
Re: Help / FAQ

cgreen...
OpenCPN supports WPL sentences for APRS position reporting (HAM "standard") for a long time. Enable it on the AIS tab in the Toolbox if you have it disabled. They have the same functionality as AIS or radar targets (track recording, creating a permanent waypoint on current position etc.)

Pavel
nohal is offline   Reply With Quote
Old 25-02-2017, 08:08   #1170
Registered User

Join Date: Jan 2017
Posts: 23
Re: Help / FAQ

Quote:
Originally Posted by nohal View Post
cgreen...
OpenCPN supports WPL sentences for APRS position reporting (HAM "standard") for a long time. Enable it on the AIS tab in the Toolbox if you have it disabled. They have the same functionality as AIS or radar targets (track recording, creating a permanent waypoint on current position etc.)

Pavel
Pavel, that is exactly what I need. Thanks very much for the help. Chris.
cgreen is offline   Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

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


Advertise Here


All times are GMT -7. The time now is 02:13.


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.