Cruisers Forum
 

Go Back   Cruisers & Sailing Forums > Seamanship, Navigation & Boat Handling > OpenCPN
Cruiser Wiki Click Here to Login
Register Vendors FAQ Community Calendar Today's Posts Log in

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 31-10-2012, 11:05   #1
Registered User
 
rgleason's Avatar

Join Date: Mar 2012
Location: Boston, MA
Boat: 1981 Bristol 32 Sloop
Posts: 17,632
Images: 2
Opencpn Dashboard - Visual Instruments

Goal: To become familiar enough with Opencpn Debug/Release Environment and the running and compiling plugins, so that I can program some additional "graphic instruments" for the Dashboard, which I'd like to call Visual Instruments. Initially the idea is to build two Visual Instruments:
Visual Wind (and Boat)
Visual Current &Leeway (and Boat)

Please refer to this link and the conversation following with Maitai:
http://www.cruisersforum.com/forums/...ml#post1067393
and the "Dynamic-Boat-Wind-Current-Vectors.pdf" which is actually a spreadsheet I could not upload.

I've finally figured out some of the basics for programming in this system but have a very long way to go. How impractical and impossible is this idea?
Will I be able to get some assistance from the pros... I'd really like to develop my skills on this effort, but would I be stepping into someone else territory?

Thanks Rick

---------------

Where are the source files?In Microsoft Visual C++ 2010 Express, since I have installed a Debug Environment and refreshed the files using Git, the files are all current and available for creating a Debug Build or a Release Build. To the right is the Solution Explorer window which shows "Solution 'OpenCPN' " at the top. Below are various files which are either compiled or not.

If we look at the "opencpn" folder the sub-directories are pretty clearly stated External Dependencies, Header Files and we find "Source Files"
If you pick one of those files, highlight it, right click and pick 'open" it opens to the right and can be edited and saved. (dangerous if you don't know more)
You can highlight the tab for the opened file and pick close.
Where are the Plugins Source Files, because there is no way I want to mess around with Opencpn before knowing much more?
The plugins source files appear to be located just below the "ALL_BUILD" folder. There are "dashboard" directories which I don't understand right now, but the "dashboard_pi" folder appears to have the 'Source File' directory. Under this directory are files for all the instrument.cpp and nmea0183.cpp and a number of other cpp files each for a different type of sensor and each file has an include for the Nmea.h file, which is pretty important.

It appears the Nmea.h file parses the incoming nmea data stream and sorts out all the various types and sources of data into "clean" useable data that can be used by the Dashboard plugin.

It appears we can also use wxWidgets commands to get information up to the window, print, to a file, or whatever. We can also use wxWidgets graphics commands to create images.

If we are going to try to modify a plugin how do we keep our version of a plugin separate from the original?
Copy the main plugin directory to a new folder name, then start working on the changes and additions?

Then after making some changes to a plugin, how do we then compile and test the plugin with Debugging?
Since JesperWe has finally managed to convince me it is better to compile and test plugins under a release build, complying with this is important.
So I suppose, but I have not done it yet, wet build a debug version of the particular plugin directory, and then do I copy some files to the Release build of opencpn and try to run Opencpn, and then the debug plugin?
Preliminary Conclusion
Since the Dashboard plugin provides a good structure for receiving a data stream of Nmea, and the tools to display the data in Opencpn, this is perhaps a good framework to start learning to program in C++ with wxWidgets, in hopes that I can create an alternate "skin" or additional dashboard items that I would call "Visual

Git
I suppose at some point I should learn how to setup a separate git that is not just for download.
rgleason is offline   Reply With Quote
Old 31-10-2012, 14:59   #2
Registered User

Join Date: Dec 2008
Boat: Journeyman
Posts: 705
Re: Opencpn Dashboard - Visual Instruments

Quote:
The plugins source files appear to be located just below the "ALL_BUILD" folder. There are "dashboard" directories which I don't understand right now, but the "dashboard_pi" folder appears to have the 'Source File' directory.
ALL_BUILD is just a grouping that lets you issue a build for all the projects in your current solution. It doesn't contain any source files or build steps in itself, just causes all the other projects to be built.

There are some projects which are actual c++ code, but we divide them into different projects to make building faster. "opencpn" as you noticed is the main program code, but not all of it since for example the vector chart code is in S57ENC, which is built as a separate library and then linked into the opencpn project.

The dashboard_pi does the actual compile of the dashboard source. Others, like dashboard-po(t)-update, just gathers and processes translatable strings in the corresponding code.

Quote:
It appears the Nmea.h file parses the incoming nmea data stream and sorts out all the various types and sources of data into "clean" useable data that can be used by the Dashboard plugin.
You can't be that sloppy in your terminology with computers
.h files never do any processing. They just specify which classes and methods etc are available. The actual processing code is always in the .cpp file.

Quote:
If we are going to try to modify a plugin how do we keep our version of a plugin separate from the original?
Copy the main plugin directory to a new folder name, then start working on the changes and additions?
The easiest way for a beginner is to create a new Git branch where you can mess about as you like with the code of the existing plugin.

Quote:
Then after making some changes to a plugin, how do we then compile and test the plugin with Debugging?
If you work on the dashboard_pi, which is already part of the OpenCPN solution, all you need to do to debug is to copy the compiled debug version of the dll from your ...\build\plugins\dashboard_pi\Debug up to ...\build\plugins.

If you want to debug a new plugin, you need to import it into the OpenCPN solution in VS2010 and create a similar build structure as for the other plugins, the you will get a dll that you can copy into your debug execution location and get debugging in.
JesperWe is offline   Reply With Quote
Old 31-10-2012, 19:29   #3
Registered User
 
rgleason's Avatar

Join Date: Mar 2012
Location: Boston, MA
Boat: 1981 Bristol 32 Sloop
Posts: 17,632
Images: 2
Re: Opencpn Dashboard - Visual Instruments

Thanks Jesper. Right now it's a black box, and I can't learn anything about it unless I poke it, but I don't want to break anything!

Quote:
The dashboard_pi does the actual compile of the dashboard source. Others, like dashboard-po(t)-update, just gathers and processes translatable strings in the corresponding code.
Is there a difference in a po and pot? What does it stand for? -I think they are for translation files to other languages.

Quote:
The easiest way for a beginner is to create a new Git branch where you can mess about as you like with the code of the existing plugin.
Okay, this sounds like the best way to do it, and I'll try to read up more about git. I have a git login, and can download/update opencpn-git, but think I need to get a home for my Git "branch" first. -- Then I am just creating a personal image (or branch) of the entire opencpn code as I understand it. If I make a change to that branch, then there is no way I can change the original (I hope). Now will this personal branch be available locally in some directory? Do I make changes locally, test them, then I can upload or "commit" to my cloud based branch?

Quote:
If you want to debug a new plugin, you need to import it into the OpenCPN solution in VS2010 and create a similar build structure as for the other plugins, the you will get a dll that you can copy into your debug execution location and get debugging in.
I can't seem to find any "import" command in MSVC++2010. Nor is there a "copy" and "paste" for folders. There is an Add / Existing Item... I guess "import" is used to create a new plugin somehow.

Under C:\<Data-Dir>\opencpn-git\build\plugins
are dashboard_pi and grib_pi folders - These are the folders that show up under MS Visual C++ 2010 when the 'Opencpn.sln' file located in C:\<Data-Dir>\opencpn-git\build is opened. (When I successfully complete a GIT branch, will these be the folders I would work out of? )

Yet under C:\<Data-Dir>\opencpn-git\plugins
we find folders dashboard_pi and demo_pi - These do not appear because they are not under the "build" directory. - I am wondering why they are there?

C:\<Data-Dir>\opencpn-git\OpenCPN\plugins
we find folders for dashboard_pi, demo_pi_sample and grib_pi
They appear to be the very similar to the ones above. What are these for?

---
Compiled files for Debug and Release versions:
C:\Data-Dir>\opencpn-git\build\Debug
C:\Data-Dir>\opencpn-git\build\Release
rgleason is offline   Reply With Quote
Reply

Tags
opencpn


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 18:01.


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.