Cruisers Forum
 


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 29-08-2014, 02:15   #61
Registered User

Join Date: Mar 2014
Posts: 8
Re: OpenCPN PlugIn Development

Hi developers.

I want to test a function connecting to serial port in my plugin.

I know there are functions to connect to serial port in opencpn. How can I use the function? or I need to incorporate some serial communication codes?

The message looks like "$AIBIM,x-accel,y-accel,z-accel,inclination,[0|1],[0|1],*Checksum\r\n" from a device.
onecue is offline   Reply With Quote
Old 29-08-2014, 07:53   #62
Registered User

Join Date: Feb 2010
Location: Tierra del Fuego
Boat: Phantom 19
Posts: 6,208
Re: OpenCPN PlugIn Development

onecue...
Why would you do that? The message looks like normal NMEA, so if you need to receive it from a sensor:
- set WANTS_NMEA_SENTENCES flag in the return value of yourplugin_pi::Init
- Implement SetNMEASentence method

If you want to send it out, just call PushNMEABuffer

For reference look at https://github.com/SethDart/vdr_pi/b...src/vdr_pi.cpp

Pavel
nohal is online now   Reply With Quote
Old 15-09-2015, 00:02   #63
Registered User

Join Date: May 2015
Posts: 5
Re: OpenCPN PlugIn Development

Hello,
I am a new user of OpenCPN and love it already.
I have followed the windows compilation guidelines and successfully compiled OpenCPN.
Then I want to develop a pluing.
I have spent few days to find info about how can I get star,but nothing use that I find.
Any guide?

Thanks

wushinwei
wushinwei is offline   Reply With Quote
Old 15-09-2015, 05:28   #64
Registered User

Join Date: Feb 2010
Location: Tierra del Fuego
Boat: Phantom 19
Posts: 6,208
Re: OpenCPN PlugIn Development

Wushinwei...
Take any existing plugin and learn from it. Ask if something is not clear. But please try to ask questions that are a bit more atomic than "how do I write a plugin?"

Pavel


Sent from my iPhone using Cruisers Sailing Forum
nohal is online now   Reply With Quote
Old 10-03-2017, 11:03   #65
Registered User

Join Date: Feb 2017
Posts: 22
Re: OpenCPN PlugIn Development

Hi. Could you help me? I very new to plugin development. I trying to develop advanced scaled ship icon(vector, with realistic contour shape). I drew an scaled icon, but it static. It is located a specific screen position and not depends of real ship position and rotation. How can I get the location and rotation data from openCPN and bind the icon to the position of the ship?(Sorry for my English)

stn92 is offline   Reply With Quote
Old 12-03-2017, 07:01   #66
Registered User

Join Date: Aug 2009
Location: oriental
Boat: crowther trimaran 33
Posts: 4,417
Re: OpenCPN PlugIn Development

You can get the boat position from the SetPositionFixEx callback activated from WANTS_NMEA_EVENTS.

You can find the location to render by passing the location to GetCanvasPixLL


To get magnetic course you would have to decode nmea sentences.
seandepagnier is offline   Reply With Quote
Old 13-03-2017, 13:47   #67
Registered User

Join Date: Feb 2017
Posts: 22
Re: OpenCPN PlugIn Development

Quote:
Originally Posted by boat_alexandra View Post
You can get the boat position from the SetPositionFixEx callback activated from WANTS_NMEA_EVENTS.

You can find the location to render by passing the location to GetCanvasPixLL


To get magnetic course you would have to decode nmea sentences.
Thanks, everythink works fine except course. Looks like Plugin ViewPort rotated 90 degrees(Sounds funny, but it` really looks like). I can equalize the difference using a coefficient, but when the ship starts moving (I use the MNEA server emulator), the icon starts acting up. I can`t figure out on which the icon course depends. All variables involved in the process of computing the rotation are equal(i mean variables of openCPN and Plugin).
Code of my Icon Render Method - paste.org.ru

stn92 is offline   Reply With Quote
Old 13-03-2017, 15:12   #68
Registered User

Join Date: Feb 2017
Posts: 22
Re: OpenCPN PlugIn Development

I found the problem.
Code:
if (g_pfFix.Sog < 0.2) icon_rad = ((g_pfFix.Hdt + 90.) * PI / 180) + rotate;
- Condition not met because of g_pfFix.Sog gives me -1.#INF instead of 0 for some reason. I simply launch the openCPN with no MNEA server running. Sog Fix shold be 0.
stn92 is offline   Reply With Quote
Old 13-03-2017, 18:48   #69
Registered User

Join Date: Feb 2010
Location: Tierra del Fuego
Boat: Phantom 19
Posts: 6,208
Re: OpenCPN PlugIn Development

stn92...
Shouldn't you be using pSog in that condition? It seems so looking at
Code:
float pSog = g_pfFix.Sog;
if (wxIsNaN(pSog))
    pSog = 0.0;
a couple of lines above...
It would also probably be good to actually feed it with some data if you want to test if it works with data...

Pavel
nohal is online now   Reply With Quote
Old 14-03-2017, 01:03   #70
Registered User

Join Date: Feb 2017
Posts: 22
Re: OpenCPN PlugIn Development

Quote:
Originally Posted by nohal View Post
stn92...
Shouldn't you be using pSog in that condition? It seems so looking at
Code:
float pSog = g_pfFix.Sog;
if (wxIsNaN(pSog))
    pSog = 0.0;
a couple of lines above...
It would also probably be good to actually feed it with some data if you want to test if it works with data...

Pavel
Yes i should. But i forget to replace g_pfFix.Sog with pSog. Thanks.
I fed the test data, and it works fine.
And, is it posible to overlay plugin icon with original? I mean, i need to plugin layer to be above layer with openCPN icon.
stn92 is offline   Reply With Quote
Old 14-03-2017, 04:01   #71
Registered User

Join Date: Feb 2017
Posts: 22
Re: OpenCPN PlugIn Development

There is another problem. My ship turns into ugly train when starts to move.
Seems like RenderOverlay method is called only when Plugin ViewPort position changes.Or may be not. I'm just guessing.

I created the ShipUpdate method and call it each time the boat position changes.
Code:
void UpdateShips(){
	
	
	g_pDC = new ODDC(); //need to pass wxDC &dc into it
	RenderShip(*g_pDC);
}
But it no use without wxDC &dc. And i don`t know where to get it.
Am I on the right way to fix an icon? Or is the problem in something else?
stn92 is offline   Reply With Quote
Old 27-07-2017, 03:15   #72
Registered User

Join Date: Jul 2017
Posts: 5
Re: OpenCPN PlugIn Development

Hi all forum members,

I'm new in openCPN world and i found that great software is very useful. After a few weeks I decide to make my own simple plugin. I have some experience with Visual C++. So - i follow strictly instructions from here:

https://opencpn.org/wiki/dokuwiki/do...ugins_to_debug

I use Visual Studio 2017 community, CMake 3.9.0 GUI
Everything was fine - solution generation was successful, i open it in Visual studio, then build for Win32. But unfortunately - when I copy ready dll plugin file to OpenCPN directory for plugins, he did not recognize it. Mean - "projections" is not in list so I cant enable it. I try to figure it out where is my mistake but...

Kindly thanks to all that will try to help me.
xentia is offline   Reply With Quote
Old 27-07-2017, 09:10   #73
Marine Service Provider
 
bdbcat's Avatar

Join Date: Mar 2008
Posts: 7,401
Re: OpenCPN PlugIn Development

xentia...

Have a look at the OpenCPN logfile. This will tell you why the Plugin did not load. Post a copy here if necessary.

Good Luck
Dave
bdbcat is offline   Reply With Quote
Old 27-07-2017, 09:26   #74
Registered User

Join Date: Jul 2017
Posts: 5
Re: OpenCPN PlugIn Development

Thank you bdbcat,
I also try this one too:
https://opencpn.org/wiki/dokuwiki/do..._build_windows

also with no problem with cmake and build and same result - open CPN do not recognize DLL. I suppose that i miss something here... but just can't figure it out. So i follow your advice and look in log file. Here is suspected lines:

7:19:17 PM: PlugInManager searching for PlugIns in location C:\Program Files (x86)\OpenCPN\plugins
7:19:17 PM: PlugInManager: Loading PlugIn: C:\Program Files (x86)\OpenCPN\plugins\DR_pi.dll
7:19:17 PM: Error: Failed to load shared library 'C:\Program Files (x86)\OpenCPN\plugins\DR_pi.dll' (error 126: the specified module could not be found.)
7:19:17 PM: PlugInManager: Cannot load library: C:\Program Files (x86)\OpenCPN\plugins\DR_pi.dll

Thank you in advance
xentia is offline   Reply With Quote
Old 27-07-2017, 09:34   #75
Registered User

Join Date: Jul 2017
Posts: 5
Re: OpenCPN PlugIn Development

And here is my try with another one. I've decided to try this:

https://opencpn.org/wiki/dokuwiki/do...ugins_to_debug

with newest openCPN - 4.6.2 - beta

same result

7:30:18 PM: PlugInManager: Loading PlugIn: C:\Program Files (x86)\OpenCPN 4.6.2\plugins\projections_pi.dll
7:30:18 PM: Error: Failed to load shared library 'C:\Program Files (x86)\OpenCPN 4.6.2\plugins\projections_pi.dll' (error 126: the specified module could not be found.)
7:30:18 PM: PlugInManager: Cannot load library: C:\Program Files (x86)\OpenCPN 4.6.2\plugins\projections_pi.dll
xentia is offline   Reply With Quote
Reply


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
New Marina Development in China GordMay Pacific & South China Sea 4 29-09-2009 04:33
New Battery Research & Development BlueSovereign Electrical: Batteries, Generators & Solar 7 31-07-2009 14:47
Nautical Development 39 (Morgan 39?) riptide Monohull Sailboats 1 22-07-2009 11:53
Turks and Caicos Development Petition Canibul Atlantic & the Caribbean 5 24-04-2008 18:15

Advertise Here


All times are GMT -7. The time now is 18:22.


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.