Cruisers Forum
 


Join CruisersForum Today

Reply
 
Thread Tools Rate Thread Display Modes
Old 20-04-2016, 22:49   #1
Registered User

Join Date: Apr 2016
Posts: 19
Plugin Development Help

Hi,

As a relatively novice programmer I am having trouble with my attempt at doing some plugin development. I have so far looked though some of the available plugins and have attempted to compile/build some plugins from their source code so that I can try changing things, recompiling, and testing.

Unfortunately haven't been able to successfully build any of the plugins I have tried. I am using VS 2013 (although I do have 2010 and 2015 installed) and installed cmake, poedit, NSIS, and the newest release of wxWigets.

I have not compiled or built the full openCPN project but I downloaded the source code of this as well as multiple plugins which I placed into the plugins folder of openCPN. I then create a build folder, copy in opencpn.lib (that I got off github) and do:

cmake ..
cmake --build .

cmake .. generally doesn't fail although it says the dependency opencpn does not exist.

cmake --build usually has multiple errors that dont make much sense such as (i am paraphasing as I dont remember the actual errrors) the operation ^= is arbitrary, or files not being found.

I'm wondering if its the compiler I am using is wrong or maybe I need to build openCPN first??

What should the steps be to compile/build the demo_pi_sample program for instance?

Thanks!
__________________

__________________
THEMuffinMan7 is offline   Reply With Quote
Old 20-04-2016, 23:03   #2
Registered User

Join Date: May 2012
Posts: 405
Re: Plugin Development Help

A good first step would be to compile OpenCPN 4.2 from source, following the instructions here:

http://opencpn.org/ocpn/compiling_source_windows

Once you have this compiling you can use the built-in plugins as a sand pit.

Not sure if the demo_pi_sample can be used to produce anything useful. The render functions do not do anything.

Perhaps another coder could point you to a simple plugin to play with, in addition to the ones included with the OpenCPN source code.
__________________

__________________
Rasbats is offline   Reply With Quote
Old 21-04-2016, 11:35   #3
Registered User

Join Date: Apr 2016
Posts: 19
Re: Plugin Development Help

Thanks for the reply. I compiled OpenCPN according to the instructions and everything seemed to work (although some warning messages ie. policy CMP0043 is not set & warning c4005), however when I try running it after installing from the NSIS package I get "The program can't start because wxmsw310u_gl_vc_custom.dll is missing"

Also when I try running it from the build folder without installing I get "The program cant start because libcurl.dll is missing from my conputer"

any ideas? I also noticed in the beginning it said "compiling for VS 14.0". Should this be 12.0?
__________________
THEMuffinMan7 is offline   Reply With Quote
Old 21-04-2016, 14:04   #4
Registered User

Join Date: May 2012
Posts: 405
Re: Plugin Development Help

It looks like you are using wxWidgets 3.1. I think you will find that 3.0.2 is the version used for the standard installation. It may be better to re-work with 3.0.2.

Did you try to compile with VS 2013? That will be your main tool when playing with the plugins. To solve problems with different versions of wxWidgets I found CMake GUI useful for generating the solution file for VS.
msw should be changed to mswu to make sure you are running with unicode for the different operating systems.

If you have downloaded OpenCPN 4.2 and installed it you will find libcurl.dll in the program folder. Can you try copying that to your build folder and try to run O from that folder? For me a lot of stuff is 'try and see if it works'. This is part of the learning process.

Mike
__________________
Rasbats is offline   Reply With Quote
Old 21-04-2016, 15:54   #5
Registered User

Join Date: Apr 2016
Posts: 19
Re: Plugin Development Help

I got it working, thanks. For some reason the files in buildwin and the wxWidget files weren't being linked correctly so I had to copy a bunch of .dll's to the build folder. I also corrected the wxWidget version number issue by changing the system path to the 3.0.2 version as well as made sure it was using VS 12.0 instead of 14.0 by cmake -G "Visual Studio 12" -T v120_xp ..

Now I am just confused as to what the best / easiest way to start playing around with plugins is. When I run opencpn from build/debug I do not see any plugins under settings. I also tried individually compiling the plugins again from opencpn/plugins without success. Hopefully I do not have to re-build opencpn every-time I want to test a plugin. I do see plugins under settings after creating the installation package and installing and they seem to work fine.

If this should be obvious I apologize.
__________________
THEMuffinMan7 is offline   Reply With Quote
Old 21-04-2016, 16:29   #6
Registered User

Join Date: Feb 2010
Location: On the go. Not in Prague.
Posts: 4,016
Re: Plugin Development Help

Good you got it working. Probably the easiest way to debug a plugin in VisualStudio is to place it's source tree to the plugins subfolder of the core source (the place where the bundled plugins are) and edit https://github.com/OpenCPN/OpenCPN/b...nager.cpp#L291
to something like
Code:
m_plugin_location = _T("C:\\source\\opencpn\\build\\plugins\\myplugin_pi\\Debug");
(the place where the plugin DLL is built)

Pavel
__________________
nohal is offline   Reply With Quote
Old 22-04-2016, 16:55   #7
Registered User

Join Date: Apr 2016
Posts: 19
Re: Plugin Development Help

I think I have it setup like you said, however does this allow me to debug while the program is running? Or is it just a matter of re-compiling and then running opencpn?

I've been looking at some plugins and... There is a lot going on. What I ultimately want to do is draw a trace on the map of where the boat has been similar to the tracking function in opencpn except more accurately referenced and the width of the "line" would be up to 100m wide and dependent on depth. The end goal is to show coverage of a side scan survey..

A good starting place would be to figure out how to draw something on the map (preferable geo-referenced) .. could you point me to some functions that might help with this?? Its difficult to figure out from the source code what does what without documentation. Maybe there is some documentation somewhere I don't know about?

I appreciate the help I've been getting on here! Cheers
__________________
THEMuffinMan7 is offline   Reply With Quote
Old 22-04-2016, 17:10   #8
Registered User

Join Date: Feb 2010
Location: On the go. Not in Prague.
Posts: 4,016
Re: Plugin Development Help

Of course, this is the way to debug the plugins as I said in my previous post.
Build the whole solution with the change I mentioned in that post, place a breakpoint somewhere in the plugin code (The constructor or Init method would be a wise place to begin with to be sure that it actually gets executed) and start the opencpn project.

Pavel
__________________
nohal is offline   Reply With Quote
Old 22-04-2016, 17:13   #9
Registered User

Join Date: Feb 2010
Location: On the go. Not in Prague.
Posts: 4,016
Re: Plugin Development Help

When you start actually reading the code of the existing plugins, you will sure find plenty of examples of drawing yourself, for one you may start looking at https://github.com/nohal/iacfleet_pi...cfile.cpp#L679

Pavel
__________________
nohal is offline   Reply With Quote
Old 23-04-2016, 02:03   #10
bcn
Registered User

Join Date: May 2011
Location: underway whenever possible
Boat: Rangeboat 39
Posts: 2,751
Re: Plugin Development Help

Quote:
Originally Posted by THEMuffinMan7 View Post

I've been looking at some plugins and... There is a lot going on. What I ultimately want to do is draw a trace on the map of where the boat has been similar to the tracking function in opencpn except more accurately referenced and the width of the "line" would be up to 100m wide and dependent on depth. The end goal is to show coverage of a side scan survey..

A good starting place would be to figure out how to draw something on the map (preferable geo-referenced) .. could you point me to some functions that might help with this??
You might study the "under construction" Hydrographic Survey Plug-in and perhaps team-up with Rasbats/Mike trying to bundle efforts.

Do I understand you right that you want to implement something like a "color coded" track where the color is "width" showing the range of the side scan depending on depth?
__________________
bcn is offline   Reply With Quote
Old 23-04-2016, 03:18   #11
Registered User

Join Date: May 2012
Posts: 405
Re: Plugin Development Help

survey_pi (forked from Pavel/Konni) certainly has a lot of the ingredients for what you are looking at.

People have had a lot of problems compiling the plugin because of the external libs.

Suggest a first step would be to try installing the plugin on O 4.2 and see what it offers. See this post/thread:

Hydrographic Survey Plugin

Send me a private message if you need some help.

Mike
__________________
Rasbats is offline   Reply With Quote
Old 24-04-2016, 13:31   #12
Registered User

Join Date: Apr 2016
Posts: 19
Re: Plugin Development Help

Thanks Rasbats. I actually was able to compile survery-pi a couple days ago and got it to run, but when I loaded the included sample NMEA data I couldn't see any soundings drawn to the map? My plan for today was to look at draw-pi to get a handle on drawing things on the map. I will look at survey-pi for sure though and it might make sense to eventually add the features I want to that plugin? PS: Regarding all those external libs, do you think I'd need/want to use them as well? I'll have to look at it more to see what they are used for.

bcn: The track wont be color coded for width, it will actually be physically as wide as the SS coverage, which will be set by the user as some number multiplied by water depth.. (or just a fixed width if depth data isn't available). Whether this can be done with single lines of varying width or by drawing many lines perpendicular to the heading, or by some other method I'm not sure. If you have any recommendations let me know.

Ideally the track could be colored for depth or variance/error but this would require being able to process the data coming from the sonar.
__________________
THEMuffinMan7 is offline   Reply With Quote
Old 24-04-2016, 13:38   #13
bcn
Registered User

Join Date: May 2011
Location: underway whenever possible
Boat: Rangeboat 39
Posts: 2,751
Re: Plugin Development Help

Quote:
Originally Posted by bcn View Post
Do I understand you right that you want to implement something like a "color coded" track where the color is "width" showing the range of the side scan depending on depth?
"color coded" just wants to indicate - you want to show a track with an additional parameter which determines the presentation: in your case an indicator of the width of the swath a given moment.
Parameters or values like speed, water temp, depth etc. would be other characteristics to be drawn. General case, not your particular one.
__________________
bcn is offline   Reply With Quote
Old 24-04-2016, 13:56   #14
Registered User

Join Date: May 2012
Posts: 405
Re: Plugin Development Help

'Zoom To' is causing survey_pi to crash my O 4.2 at the moment. To be looked at.

The Tamar examples are for the River Tamar (50 27N, 004 12W), Devon, UK and I can import tamar.gmp and load nmea file tamar.txt.

Mike
__________________
Rasbats is offline   Reply With Quote
Old 27-04-2016, 10:16   #15
Registered User

Join Date: Apr 2016
Posts: 19
Re: Plugin Development Help

What do I have to do to create a valid PlugIn_ViewPort or PlugIn_Position_Fix object? Currently all the properties (lat long etc) are nonsense values.
__________________

__________________
THEMuffinMan7 is offline   Reply With Quote
Reply

Tags
men, plug

Thread Tools
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


Similar Threads
Thread Thread Starter Forum Replies Last Post
OpenCPN PlugIn Development bdbcat OpenCPN 78 29-07-2017 03:15
Accessing waypoints from plugin development Cags OpenCPN 16 22-10-2015 11:05
APRS Plugin Development alawatsakima OpenCPN 8 21-09-2015 13:21
Plugin Development Question pelle2004 OpenCPN 3 04-07-2012 02:00
New Plugin Development on Linux globalkeith OpenCPN 5 03-05-2012 08:16



Copyright 2002- Social Knowledge, LLC All Rights Reserved.

All times are GMT -7. The time now is 23:14.


Google+
Powered by vBulletin® Version 3.8.8 Beta 1
Copyright ©2000 - 2017, vBulletin Solutions, Inc.
Social Knowledge Networks
Powered by vBulletin® Version 3.8.8 Beta 1
Copyright ©2000 - 2017, vBulletin Solutions, Inc.

ShowCase vBulletin Plugins by Drive Thru Online, Inc.