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 16-03-2022, 22:31   #361
Registered User

Join Date: Feb 2022
Location: east coast Australia
Boat: Bespoke Catamaran 9m
Posts: 4
Re: New Plugin NmeaConvertor

Hi, and forgive my technical ignorance, but I am getting stuck with my investigations and need help.

I have windows opencpn, a Raymarine st2000+ which needs nmea VWR sentence to operate in wind mode. I am hoping to add a windsensor to utilize the sail to wind function but the one I like only sends nmea MWV.

Initially, I thought that the NMEA converter plugin would be able to do this, and I think I can probably master the straight forward calculations for wind speed into knots, m/s, km/hr needed for the VWR sentence.

My big problem is the conversion of 0 to 360 degree wind angle to 180 degree left and right data needed at the beginning of the VWR sentence. I am lost here.


I would think that this combination of equipment is not rare, and has probably been addressed many times, but I cannot find a solution, or at least one I understand.

I would be pleased if I could gain some enlightenment on if, and how, my problem could be solved.

Assistance would be appreciated.
Glengarry1 is offline   Reply With Quote
Old 17-03-2022, 03:11   #362
Registered User
 
Antipole's Avatar

Join Date: Oct 2019
Location: Emsworth, UK
Boat: Alubat Ovni 395
Posts: 316
JavaScript plugin

You can use the JavaScript plugin to create a script to do this.

In the User Guide there is an example script Process and edit NMEA sentences which would be a good point to start from. It's in Section 15 B in version 1.1 of the guide.
It shows how to collect data from one sentence and modify another. You could collect the data you need from MWV sentences and generate VMR sentences.

While developing your script, add
Code:
print(result, "\n");
before the output sentence
Code:
OCPNpushNMEA(result);

That way you will see what your result is while you experiment.
Antipole is offline   Reply With Quote
Old 17-03-2022, 05:26   #363
Registered User
 
rgleason's Avatar

Join Date: Mar 2012
Location: Boston, MA
Boat: 1981 Bristol 32 Sloop
Posts: 17,765
Images: 2
Re: New Plugin NmeaConvertor

See the Plugin's Manual for an example.
https://opencpn-manuals.github.io/ma...ut_tw_in_knots



Quote:
Originally Posted by Glengarry1 View Post
Hi, and forgive my technical ignorance, but I am getting stuck with my investigations and need help.

I have windows opencpn, a Raymarine st2000+ which needs nmea VWR sentence to operate in wind mode. I am hoping to add a windsensor to utilize the sail to wind function but the one I like only sends nmea MWV.

Initially, I thought that the NMEA converter plugin would be able to do this, and I think I can probably master the straight forward calculations for wind speed into knots, m/s, km/hr needed for the VWR sentence.

My big problem is the conversion of 0 to 360 degree wind angle to 180 degree left and right data needed at the beginning of the VWR sentence. I am lost here.


I would think that this combination of equipment is not rare, and has probably been addressed many times, but I cannot find a solution, or at least one I understand.

I would be pleased if I could gain some enlightenment on if, and how, my problem could be solved.

Assistance would be appreciated.
rgleason is offline   Reply With Quote
Old 17-03-2022, 19:10   #364
Registered User

Join Date: Feb 2022
Location: east coast Australia
Boat: Bespoke Catamaran 9m
Posts: 4
Re: New Plugin NmeaConvertor

Thanks very much for your help Gentlemen. I shall go to school on the advice.
Cheers
Glengarry1 is offline   Reply With Quote
Old 03-04-2022, 18:34   #365
Registered User

Join Date: Feb 2022
Location: east coast Australia
Boat: Bespoke Catamaran 9m
Posts: 4
Re: New Plugin NmeaConvertor

Well I have diligently been studying the NMEA CONVERTER, and JS plugin but my incompetence is legendary. My wind instrument is at the boat now but I cannot get there until mid late May. Accordingly, my mission to convert an incoming NMEA MWV sentence information from an Autonnic NMEA 1083 wind instrument into an output of in the form of a VWR sentence to enable my ST2000+ to operate in wind mode remains theoretical.

I think that the output sentence in NMEA CONVERTER might be:


$XXVWR,(unknown argument for 0-180 degrees), (unknown argument for wind right or left of bow), IMWV3,N,WIMWV3*0.51444,M,WIMWV3*1.852,K,


I have no idea how to complete fields 1 and 2 in this sentence and I do not understand the maths in the example given which seems to be doing the opposite, ie VWR to MWR

The NMEA Converter plugin does not seem to allow for an IF THEN argument so converting WIMWR1 360 degree wind direction reading into an equivalent 180 degrees from bow reading, and for the second field an argument to determine whether that relative wind angle is to the right or the left of the bow is not available in that plugin.

Accordingly, I have hit the wall in this option here.

My attention then turned to the javascript plugin.

My reading, with little true comprehension, seems to indicate that a competent person could write a script that would be able to receive a incoming NMEA sentence, break into fields (split), deal with individual fields with a routine, then reassemble a new sentence in the right format, using the products (spluttering??), and finally, send that newly constructed sentence to the autopilot.

Unfortunately the skills needed for this activity is well beyond my competence, which clearly is non existent.


However, my attempts to try to understand what is needed led me to the javascript concept of "const". My vague understanding is that you can construct an argument that deals with the constant in alternate ways.

Accordingly, I have attempted a draft below, which seeks to receive MWV1, (wind direction in 360 degree format), and determine action on whether;

(a) that numeral is equal or less than 180. If so, then the contents is inserted in XXVWR1 as is, or if not, then that numeral must be greater than 180 and the formula 360-MWV1 is calculated, and the product is inserted into XXVWR1, and this must also be less than 180 and be the equivalent angle from the bow and,

(b) XXVWR2 is determined in a like fashion, so if WIMWR1 is 180 or below, type the letter "R", otherwise type the letter "L". The field would then show the relative right or left side of the bow.

I do not know if the script below is right, or appropriate, it is just my bumbling attempt at something that I really do not understand.


const angle = 180;

if (angle <=180) {
("WIMWV1");
} else {
("360-WIMWV1");
}


const windside = 180;

if (windside <=180) {
("R");
} else {
("L");
}


I am pretty sure that writing a Javascript for the whole process is beyond
me. Likewise finding a solution in NMEA CONVERTER is also beyond me.


However the combination might work, i.e. fill fields 1, and 2 with javacript arguments to fill them and leave that NMEA CONVERTER complete the res and the connection to the autopilot.

How to achieve the script, and insertion, is a great mystery to me indeed, if it is possible or desirable.

Any assistance or guidance would be appreciated in my quest.

my brain hurts thinking about this.

cheers
Glengarry1 is offline   Reply With Quote
Old 04-04-2022, 01:20   #366
Registered User
 
Antipole's Avatar

Join Date: Oct 2019
Location: Emsworth, UK
Boat: Alubat Ovni 395
Posts: 316
Re: New Plugin NmeaConvertor

@Glengarry1...

Have a look at this test script:
Code:
mwv = "$WIMWV,329.95,R,12.5,N,A"

splut = mwv.split(",");
direction = splut[1];
if (direction <= 180) LR = "R";
else {
	direction = (360 - direction).toFixed(2);
	LR = "L";
	}

vwr = "$JSVWR" + "," + direction + "," + LR + "," + splut[3] + ",N";

print(vwr, "\n");
It creates a sample mwv sentence and prints a vwr sentence - if I have understood it correctly. You can play with different mwv sentences to see if the vwr is what you want. (The .toFixed(2) bit is to truncate the result of the calculation to two decimal places.)

Assuming the above is what you want, you can put it into an actual NMEA processing script adapting the example 15 B from the User Manual. So it will look like:
Code:
OCPNonNMEAsentence(processNMEA);

function processNMEA(input){
	if (input.OK){
		sentence = input.value;
		if (sentence.slice(3,6) == "MWV"){
			splut = mwv.split(",");
			direction = splut[1];
			if (direction <= 180) LR = "R";
			else {
				direction = (360 - direction).toFixed(2);
				LR = "L";
				}
			vwr = "$JSVWR" + "," + direction + "," + LR + "," + splut[3] + ",N";
			// print(sentence, "\n", vwr, "\n\n");
			OCPNpushNMEA(vwr);
			}
		}
	OCPNonNMEAsentence(processNMEA);
	};
I have included a print statement, commented out, which would print both the MWV and VWR sentences so you can check it is working.
I have not actually run this but it should work.
Antipole is offline   Reply With Quote
Old 04-04-2022, 16:56   #367
Registered User

Join Date: Feb 2022
Location: east coast Australia
Boat: Bespoke Catamaran 9m
Posts: 4
Smile Re: New Plugin NmeaConvertor

WOW, Thanks for your efforts.

I think I follow the logic. I need to get to the boat and try the material in real operation which would really clarify the situation for me.

Thanks very much for your assistance, it is appreciated.

I shall report back in a few weeks.

Cheers
Glengarry1 is offline   Reply With Quote
Old 24-08-2022, 14:42   #368
jaq
Registered User

Join Date: Aug 2022
Posts: 1
Re: New Plugin NmeaConvertor

Hi, thank you for the plugin it is very useful piece of software.

There was an answer few post before that input and output need to heave different header.

Is it possible to change order in received string and sent it using the same header just in different order?

$WIXDR,P,100553.8,P,QNH,C,26.2,C,TA1,H,69.8,P,UU*2 E

and change it to

$WIXDR,HUMIDITY,TEMP,PRESSURE
jaq is offline   Reply With Quote
Old 20-11-2022, 06:36   #369
Registered User

Join Date: Apr 2018
Location: PSL France
Posts: 7
Re: New Plugin NmeaConvertor

Hello,

I just upgraded my Rpi4 to the latest bullseye OS. I use now the flatpak rev of openCPN.
I'm trying to import NMEA converter plugin through openCPN and it's not working.

Any advice please?

Thank you
yollivie is offline   Reply With Quote
Old 20-11-2022, 08:05   #370
Registered User
 
rgleason's Avatar

Join Date: Mar 2012
Location: Boston, MA
Boat: 1981 Bristol 32 Sloop
Posts: 17,765
Images: 2
Re: New Plugin NmeaConvertor

What are you trying to do again?
Are you using the Plugin Manager, and selecting the Nmea Plugin and downloading it?
Also if that plugin does not appear, I may not have been built for your flatpak rpi version.
rgleason is offline   Reply With Quote
Old 20-11-2022, 08:38   #371
Registered User

Join Date: Apr 2018
Location: PSL France
Posts: 7
Re: New Plugin NmeaConvertor

Thank you for your answer. Yes it doesn't appear in the plugin manager, as it is not part of the master plugin catalogue. In the previous OS I could install it manually in the terminal but I don't know the command line with flatpak.
yollivie is offline   Reply With Quote
Old 20-11-2022, 08:43   #372
Registered User
 
rgleason's Avatar

Join Date: Mar 2012
Location: Boston, MA
Boat: 1981 Bristol 32 Sloop
Posts: 17,765
Images: 2
Re: New Plugin NmeaConvertor

OK, perhaps you can find one that will work from our Cloudsmith Repository.
https://cloudsmith.io/~opencpn/repos/


Find nema_converter_pi repository and download the files you think might work. Then "import" and try to install the plugin. You may not find one that works.


You don't really say exactly what OS and Opencpn versions.
rgleason is offline   Reply With Quote
Old 20-11-2022, 13:13   #373
Registered User

Join Date: Apr 2018
Location: PSL France
Posts: 7
Re: New Plugin NmeaConvertor

Thank you for your answer.

My setup:
rpi/4
RaspiOS/Bullseye/64
Flatpak stable branch OpenCPN 5.6.2.0+b75be76

It seems to run fine but for.now I can't find a way to install nmeaconverter, even through the repository.

The only way for now would be to switch to open plotter maybe. I need to translate a air-T° NMEA sentence from my LCJ CV7 RF sensor.
yollivie is offline   Reply With Quote
Old 20-11-2022, 15:28   #374
Registered User
 
rgleason's Avatar

Join Date: Mar 2012
Location: Boston, MA
Boat: 1981 Bristol 32 Sloop
Posts: 17,765
Images: 2
Re: New Plugin NmeaConvertor

RaspiOS/Bullseye/64
So none of the flatpak support 64 bit RPI?

You could compile it yourself.

This plugin is using the ShipDriver front end.


You could ask Rooie Dirk to update and issue a new release.


Quote:
Originally Posted by yollivie View Post
Thank you for your answer.

My setup:
rpi/4
RaspiOS/Bullseye/64
Flatpak stable branch OpenCPN 5.6.2.0+b75be76

It seems to run fine but for.now I can't find a way to install nmeaconverter, even through the repository.

The only way for now would be to switch to open plotter maybe. I need to translate a air-T° NMEA sentence from my LCJ CV7 RF sensor.
rgleason is offline   Reply With Quote
Old 20-11-2022, 16:16   #375
Registered User

Join Date: Apr 2018
Location: PSL France
Posts: 7
Re: New Plugin NmeaConvertor

Yes I think I have tried all of them without success. Tried as well to update Alpha and Beta plugin catalog in the plugin manager: nmeaconverter plugin still not available in my flatpak rev.

Unfortunately, I am no expert, don't know how to compil that myself.

But Thank you for your help, hopefully it will be avilable in the future.
Yann
yollivie is offline   Reply With Quote
Reply

Tags
nmea, plug


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
Calculator_pi New Finished Plugin for OpenCPN SaltyPaws OpenCPN 136 28-12-2022 07:19
New IAC Fleetcode Plugin for OpenCPN CBorchardt OpenCPN 77 23-04-2019 05:40
New Plugin Development on Linux globalkeith OpenCPN 5 03-05-2012 07:16
New History Plugin for OpenCPN seandepagnier OpenCPN 11 04-10-2010 14:11

Advertise Here


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


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.