seandepagnier / weather_routing_pi

weather routing plugin for opencpn
GNU General Public License v3.0
46 stars 36 forks source link

Plugin doesn't work if used with "OpenCPN -p" (portable installation on USB stick) #163

Open Sokratte opened 6 years ago

Sokratte commented 6 years ago

Hi,

I noticed that the portable install still wants to use C:\ProgramData\openCPN\plugins\weather_routing for polars (on windows). Particularly there is an error with the contour files. Also, polars created will not be saved on the stick, but on the computer's local harddrive. Didn't seem to get it to work properly, so...

Fixed it with a windows-batch file, but it would be nice if it worked without cheating.

The batch is here: https://www.dropbox.com/s/q0ggrsephnq3nk9/Start_OpenCPN.bat?dl=0

Put it on github, cruisersforum.com or the OpenCPN online manual, if you like. I also did send it to Rick on cruisersforum.com.

When I get back ashore and have the time I might do some coding on your plugin, or writing for the OpenCPN online manual - I have 6 weeks on a trip from the canaries to germany on the Alexander von Humboldt II to extensively test your plugin ;-)

Cheers! Martin

P.S.: I compiled the current version of your plugin on github and used it with OpenCPN 4.8.2 Build 2018-02-06. Didn't test other versions...

rgleason commented 6 years ago

Martin, it sounds like you managed to get your environment setup. Congratulations! Is it using XP? I've download your script, and will make a Tracker post under the Weahter_routing PI and upload your script and notes about Portable installation. https://opencpn.org/flyspray/

Thank you for reporting the problem! Have a good voyage, and we look forward to your return report.

PS: Issues is a fine place to report these things too.

rgleason commented 6 years ago

I am going to add Martin's batch file here to. Start_OpenCPN.bat.docx

Please remove the docx

seandepagnier commented 6 years ago

Doesn't this affect a lot more than just the weather routing plugin?

How do the paths change? What plugin handles it correctly?

Sokratte commented 6 years ago

I have: Chart Scale, Chart Downloader, WMM, OCPN Draw, Climatology, GRIB, WeatherRouting, Calculator, Celestial Navigation.

Didn't use CelNav yet, but none of the others seem to save anything in C:\ProgramData.

The batch-file could be easily modified to not just cover the WeatherRouging plugin, but the whole plugin-folder. It just wasn't necessary for me.

I do have a file "_OpenCPNCHRTLIST.DAT" in my USB stick root folder, which I suppose shouldn't be there, but everything seems to work. I read about a Chart-bug with portable OpenCPN and this file's location, but it seems to work anyways. Let's see how it works on the ship, there is a Windows 10 notebook (yuck).

Hakansv commented 6 years ago

Sean.. As far as I know no plugin can be aware of if O is in portable mode or not. Thus they can't be prepared to save files on the local directory, like a stick. Plugins will always save to the system user dir. (c:\... on Win) This would be a simple fix if the plugin's API contained the status of: "g_bportable". Then it could use the same logic as O-main. Compare this PR: https://github.com/OpenCPN/OpenCPN/pull/1012 It can also be that I wasn't capable to find an API-way for this. Could you have a look? Håkan

seandepagnier commented 6 years ago

I think the plugin api should instead provide the path to store data. We don't otherwise care about portable mode (which only exists in windows anyway)

So far every plugin has duplicated this function, so this would solve two problems.

On 3/14/18, Håkan Svensson notifications@github.com wrote:

Sean.. As far as I know no plugin can be aware of if O is in portable mode or not. Thus they can't be prepared to save files on the local directory, like a stick. Plugins will always save to the system user dir. (c:\... on Win) This would be a simple fix if the plugin's API contained the status of: "g_bportable". Then it could use the same logic as O-main. Compare this PR: https://github.com/OpenCPN/OpenCPN/pull/1012 It can also be that I wasn't capable to find an API-way for this. Could you have a look? Håkan

-- You are receiving this because you commented. Reply to this email directly or view it on GitHub: https://github.com/seandepagnier/weather_routing_pi/issues/163#issuecomment-373053424

Hakansv commented 6 years ago

re: "I think the plugin api should instead provide the path to store data." Yes, of course, very good. That's the derived function of being in portable mode.

re: "So far every plugin has duplicated this function, so this would solve two problems." So, they have! I've missed that. Do you have an example please for me to learn by. Thanks/ Håkan

Sokratte commented 6 years ago

AAAAAAAAAAAAAAAAAAHHHHHHHHHHHHHHHHHHH!!!!!!!!!!!!!!

I just noticed something odd...

I copied the plugin folder from ProgramData to my USB stick, but there are already files in OpenCPN\plugins\weather_routing_pi\polars, and there is also a folder data in weather_routing and it contains a copy of the plugin folder with another polars folder...

Now I have 3 polar-folders on my stick :-)))

the one I made is obviously wrong, but since when is there a "data" folder in the plugin\weather_routing_pi folder?

I thought I made a clean install before I copied it on the stick. Maybe I did run both, the old and new weather_plugin on that install?

Anyways, if you wanna use my batch-file, copy the plugins\weather_routing_pi folder directly into the OpenCPN folder and rename it to "weather_routing", or change the path in the batch to point to the right folder. Maybe I can do it later after I finished packing. My flight leaves tomorrow very early :-\

Ah no problem, I can also fix it on board. I'll have Internet in port :-)

rgleason commented 6 years ago

Sokratte The data files are all present on Opencpn Program Source/plugins/weather_routing_pi/data In Windows: C:\Program Files (x86)\OpenCPN 4.8.2\plugins\weather_routing_pi\data with subdirectories for Boats and Polars.

When the program is started or initialized the portions that need to be user writeable must be copied over to a User Directory so that the User can make changes. Therefore the files are then copied over to

C:\ProgramData\opencpn\plugins\weather_routing (in the case of windows) with directories for polars, contours and boats with the weatherroutingconfiguration.xml file.

These are the files that are referenced by the Plugin and they are the ones that are used to save user changes and are the directories where the respective new files are saved.

See the WeatherRouting Documentation

rgleason commented 6 years ago

Sean, regarding checking all the existing polars in the polar folder. Should I remove all columns that have all 0 entries? Is there anything else that should be done?

seandepagnier commented 6 years ago

Rick,

If the value should be something greater than 0, and it is for lack of data, then yes, remove it.

If it is 0, because the wind is too high, leave it for now.

Most likely I will change the logic so that 0 will mean not to propagate in that direction. If you really mean to hold position then a very small value of .01 can be used.

Sean

On 3/14/18, Rick Gleason notifications@github.com wrote:

Sean, regarding checking all the existing polars in the polar folder. Should I remove all columns that have all 0 entries?

-- You are receiving this because you commented. Reply to this email directly or view it on GitHub: https://github.com/seandepagnier/weather_routing_pi/issues/163#issuecomment-373184673

rgleason commented 6 years ago

I think this can be closed now because Hakan's PR for Opencpn go merged for v5.00 OP or Sean has to close it.