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 27-06-2019, 15:37   #91
Registered User
 
Canne's Avatar

Join Date: Aug 2014
Posts: 246
Re: Twocan - a new Plugin

Quote:
Originally Posted by stevead View Post
...about combining the Windows plugin and drivers. My intent was to decouple these so that each could be enhanced or have bugs fixed without impacting each other. I certainly don’t want a fix to a Windows driver impacting a non-Windows version of the plugin. At the moment the Windows drivers are the Achilles heel...
Hi, I am testing right now a plugin called Tactics (not mine), which is used for performance parameters calculations, which it display via Dashboard (the "standard" O plugin). Doing that, I started to wonder is the arbitrary and sometimes slow NMEA 0183 data stream adequate to calculate the quasi real-time data containing boat's movements as arguments.

I was thinking how to speed things up (because I cannot have timestamps in any imaginable way, not on my boat) and I ended up to think NMEA 2000. I saw your ground breaking work to interface O with NMEA 2000 by NMEA 0183 conversion. But actually I want to get NMEA 2000 raw data from some key instruments, and get that at the highest possible data rate.

Do you think it would be possible to obtain the acquired raw data that you use for conversion not through O but to an external client thread (of mine) by some IPC method, like shared memory but preferably through a socket? The implementation for R&D would be on Linux.

I have made a RFC to the community, if you are interested (your work is mentioned, of course ). For the time being this remains at RFC level and I am just looking for opportunities to speed up the DAQ.

Best regards,

Petri
Canne is offline   Reply With Quote
Old 27-06-2019, 15:55   #92
Registered User

Join Date: Oct 2014
Location: Netherlands
Boat: Halmatic 30
Posts: 1,119
Re: Twocan - a new Plugin

Quote:
Originally Posted by Canne View Post
Hi, I am testing right now a plugin called Tactics (not mine), which is used for performance parameters calculations, which it display via Dashboard (the "standard" O plugin). Doing that, I started to wonder is the arbitrary and sometimes slow NMEA 0183 data stream adequate to calculate the quasi real-time data containing boat's movements as arguments.

I was thinking how to speed things up (because I cannot have timestamps in any imaginable way, not on my boat) and I ended up to think NMEA 2000. I saw your ground breaking work to interface O with NMEA 2000 by NMEA 0183 conversion. But actually I want to get NMEA 2000 raw data from some key instruments, and get that at the highest possible data rate.

Do you think it would be possible to obtain the acquired raw data that you use for conversion not through O but to an external client thread (of mine) by some IPC method, like shared memory but preferably through a socket? The implementation for R&D would be on Linux.

I have made a RFC to the community, if you are interested (your work is mentioned, of course ). For the time being this remains at RFC level and I am just looking for opportunities to speed up the DAQ.

Best regards,

Petri

Have you allready looked at the possibilies of SignalK. NMEA2K can be read by SignalK and drive instruments. But can also translate the SignalK to NMEA183.


Works fast on my RPI 3B+ and Canable can-usb adapter board.


SignalK works in combination with Canboat.


Regards,


Bram
verkerkbr is offline   Reply With Quote
Old 27-06-2019, 18:10   #93
Registered User
 
rgleason's Avatar

Join Date: Mar 2012
Location: Boston, MA
Boat: 1981 Bristol 32 Sloop
Posts: 17,753
Images: 2
Re: Twocan - a new Plugin

Steven, I do not agree. My repository of the testplugin will compile for Linux too.
The windows version had the same error and was unable to find twocannerror.h and evidently I corrected it in the wrong way.

#include ..[\inc]\twocanerror.h
I added \inc and it built.

There is correct way to fix this path problem, but since you have decided to split Windows off separately. I have decided to stop working on this plugin as I have other things to do. I has been fun.
rgleason is offline   Reply With Quote
Old 27-06-2019, 19:14   #94
Registered User
 
rgleason's Avatar

Join Date: Mar 2012
Location: Boston, MA
Boat: 1981 Bristol 32 Sloop
Posts: 17,753
Images: 2
Re: Twocan - a new Plugin

Steven,
Furthermore your rational for not merging is completely flawed if indeed, you intend this test repository to only be for Windows.
rgleason is offline   Reply With Quote
Old 28-06-2019, 06:11   #95
Registered User
 
Canne's Avatar

Join Date: Aug 2014
Posts: 246
Re: Twocan - a new Plugin

Quote:
Originally Posted by verkerkbr View Post
Have you allready looked at the possibilies of SignalK. NMEA2K can be read by SignalK and drive instruments. But can also translate the SignalK to NMEA183.
Hi Bram,

(maybe we will get flamed discussing this here )
Yes, I know it, but thanks for reminding me! Basically, what I want is wind vane, heel sensor and electronic compass (pdf) not with ultra-high sampling rate but with time domain. When I mention this to the O community the answer is that if it does not exist you do not need it... We'll they are kind of right with their wealthy Swiss knife features!

Maybe I need to be in front of the OpenCPN instead of being behind it: SignalK has a timestamp attribute in all of its objects! Also I like the clear distinction between the data collection, server and display. What comes to JavaScript, I am not all skeptic about it, the contrary since I actually write entire books using TiddlyWiki - it always works after 5+yrs and numerous browser updates, incredible!

So, maybe I will need to start thinking to modernize my boat instrumentation a bit (it is ten years old), connect to SignalK to use it to feed my own programs which I need to port to JavaScript (from C++? - not a problem) and provide O the NMEA 0183 it needs in order to be used in its main business - it is a very good chart plotter!
Quote:
Originally Posted by verkerkbr View Post
Works fast on my RPI 3B+ and Canable can-usb adapter board.
Thanks, that looks like the configuration I was thinking + now I have the name of the adapter board..
Quote:
Originally Posted by verkerkbr View Post
SignalK works in combination with Canboat.
That I did not know. It looks like a project which is live but they warn that it is not really out of box installation. Did you encounter any issues with the Canable usb-adapter? What is the data throughput you obtain?

Best regards,

Petri
Canne is offline   Reply With Quote
Old 28-06-2019, 08:00   #96
Registered User

Join Date: Oct 2014
Location: Netherlands
Boat: Halmatic 30
Posts: 1,119
Re: Twocan - a new Plugin

Quote:
Originally Posted by Canne View Post
Hi Bram,

(maybe we will get flamed discussing this here )
Yes, I know it, but thanks for reminding me! Basically, what I want is wind vane, heel sensor and electronic compass (pdf) not with ultra-high sampling rate but with time domain. When I mention this to the O community the answer is that if it does not exist you do not need it... We'll they are kind of right with their wealthy Swiss knife features!

Maybe I need to be in front of the OpenCPN instead of being behind it: SignalK has a timestamp attribute in all of its objects! Also I like the clear distinction between the data collection, server and display. What comes to JavaScript, I am not all skeptic about it, the contrary since I actually write entire books using TiddlyWiki - it always works after 5+yrs and numerous browser updates, incredible!

So, maybe I will need to start thinking to modernize my boat instrumentation a bit (it is ten years old), connect to SignalK to use it to feed my own programs which I need to port to JavaScript (from C++? - not a problem) and provide O the NMEA 0183 it needs in order to be used in its main business - it is a very good chart plotter!
Thanks, that looks like the configuration I was thinking + now I have the name of the adapter board..
That I did not know. It looks like a project which is live but they warn that it is not really out of box installation. Did you encounter any issues with the Canable usb-adapter? What is the data throughput you obtain?

Best regards,

Petri

Hi Petry,

at first you have to activate the canable board:

sudo ip link set can0 up type can bitrate 250000

(that seems to be the speed of NMEA2K)

that is all to get the canable board working (be done with the startup). I do this at the start in the terminal.

With the OpenPlotter in the Rasperry Pi SignalK is allready installed.

Then go to the SignalK menu and login:

In the Appstore > available you see a lot of options like:

signalK to NMEA183
signalK to NMEA2K

Then you have to switch the plugins on.

Opcan receives NMEA2K in signalK etc. etc.

The data to NMEA183 you have to indicate what you like to receive.

The plugin Twocan seems to be based on more or less the same principle like canboat.

Regards,

Bram
verkerkbr is offline   Reply With Quote
Old 28-06-2019, 11:57   #97
Registered User
 
rgleason's Avatar

Join Date: Mar 2012
Location: Boston, MA
Boat: 1981 Bristol 32 Sloop
Posts: 17,753
Images: 2
Re: Twocan - a new Plugin

Quote:
Originally Posted by LennartG View Post
Rick,

Linux has a tool called 'iconv' for conversion. Search for 'man iconv' and you will find.

/LennartG
Thank you Lennart

Very useful https://linux.die.net/man/1/iconv
I would use

iconv -f UTF8 -t ISO88592 < input.txt >

iconv -f [from encoding] -t [to encoding] [input file]

What is the to encoding supposed to be?
rgleason is offline   Reply With Quote
Old 28-06-2019, 12:27   #98
Registered User

Join Date: Aug 2016
Location: Stockholm, Sweden
Posts: 289
Re: Twocan - a new Plugin

Rick,
The encoding is supposed to be UTF-8 (standard ascii, no extended characters) but I suppose the text is ascii UTF-16 (standard windows encoding). The problem is likely some copyright marks added as the special character, not as (c).
Uneducated guess but I've seen it before.
/LennartG
LennartG is offline   Reply With Quote
Old 29-06-2019, 15:14   #99
Registered User
 
rgleason's Avatar

Join Date: Mar 2012
Location: Boston, MA
Boat: 1981 Bristol 32 Sloop
Posts: 17,753
Images: 2
Re: Twocan - a new Plugin

Lennart, that is clear, I think. Do you have any clue which file to do this on?
rgleason is offline   Reply With Quote
Old 30-06-2019, 05:32   #100
Registered User

Join Date: Aug 2016
Location: Stockholm, Sweden
Posts: 289
Re: Twocan - a new Plugin

Rick, I'm not a programmer so I can't really tell but to find the files with non-ASCII characters (and list the line numbers) you may use something like this (in Linux of course ):
Become super user with 'sudo su'
cd to 'usr/local/src/twocan_pi/src' directory

Then use find and two exec-commands plus grep to find lines within the files in that directory that contains non-ASCII characters. The first exec prints the filename while the second prints eventual non-ASCII characters. You may use e.g. this for the src-directory:

find . -name "*.cpp" -exec echo {} \; -exec grep -n -P "[\x80-\xFF]" {} \;

For the inc directory (containing just header files) you change the name filter and use:

find . -name "*.h" -exec echo {} \; -exec grep -n -P "[\x80-\xFF]" {} \;

You will find a number of 'registered trademark characters' used. Can't tell if that is the problem but a programmer should be able to. You could also use this method to search in a wider concept (see 'man find') but this should be a good start.
/LennartG
LennartG is offline   Reply With Quote
Old 30-06-2019, 06:09   #101
Registered User

Join Date: Aug 2016
Location: Stockholm, Sweden
Posts: 289
Re: Twocan - a new Plugin

This is wat I got for inc and src:

root@VirtualMarine:/usr/local/src/twocan_pi/inc# find . -name "*.h" -exec echo {} \; -exec grep -n -P '[\x80-\xFF]' {} \;
./twocandevice.h
18:// NMEA2000® is a registered Trademark of the National Marine Electronics Association
./twocanerror.h
18:// NMEA2000® is a registered Trademark of the National Marine Electronics Association
./twocansettingsbase.h
./ocpn_plugin.h
./twocansocket.h
18:// NMEA2000® is a registered Trademark of the National Marine Electronics Association
./twocanplugin.h
18:// NMEA2000® is a registered Trademark of the National Marine Electronics Association
./twocanutils.h
18:// NMEA2000® is a registered Trademark of the National Marine Electronics Association
./version.h
./twocanlogreader.h
18:// NMEA2000® is a registered Trademark of the National Marine Electronics Association
./twocansettings.h
18:// NMEA2000® is a registered Trademark of the National Marine Electronics Association

root@VirtualMarine:/usr/local/src/twocan_pi/src# find . -name "*.cpp" -exec echo {} \; -exec grep -n -P '[\x80-\xFF]' {} \;
./twocansettings.cpp
18:// NMEA2000® is a registered Trademark of the National Marine Electronics Association
./twocanerror.cpp
18:// NMEA2000® is a registered Trademark of the National Marine Electronics Association
./twocandevice.cpp
18:// NMEA2000® is a registered Trademark of the National Marine Electronics Association
./twocansettingsbase.cpp
./twocanlogreader.cpp
18:// NMEA2000® is a registered Trademark of the National Marine Electronics Association
./twocanutils.cpp
18:// NMEA2000® is a registered Trademark of the National Marine Electronics Association
./twocansocket.cpp
18:// NMEA2000® is a registered Trademark of the National Marine Electronics Association
./twocanplugin.cpp
18:// NMEA2000® is a registered Trademark of the National Marine Electronics Association
150: //Trademark character ® code is \xae
root@VirtualMarine:/usr/local/src/twocan_pi/src#
LennartG is offline   Reply With Quote
Old 02-07-2019, 15:13   #102
Registered User
 
Canne's Avatar

Join Date: Aug 2014
Posts: 246
Re: Twocan - a new Plugin

Hej Lennart,

I tried this interesting plugin on my (L) ubuntu 16.04LTS. You may find it useful that I created the package files as a co-product of my tests. You can find them from here: https://github.com/canne/TwoCanPlugI...ses/tag/v1.4.0
No issues encountered,
Code:
mkdir build
cd build
cmake ..
make
make package
sudo make install
In the install I needed to make a symbolic link in ov50 default library for plugins into /usr/share... etc where the installer installs the plugin .so file, again as sudo ln -s ../../../share/... etc.

Here's a screenshot:
Click image for larger version

Name:	Screenshot from 2019-07-02 22-05-34.png
Views:	90
Size:	144.2 KB
ID:	195201

Best regards,

Petri
Canne is offline   Reply With Quote
Old 02-07-2019, 19:43   #103
Registered User
 
rgleason's Avatar

Join Date: Mar 2012
Location: Boston, MA
Boat: 1981 Bristol 32 Sloop
Posts: 17,753
Images: 2
Re: Twocan - a new Plugin

BTW, I have been investigating this repositories only error, and have concluded that
#include "../inc/twocanerror.h" at line 27 in twocanerror.cpp
1. Is completely parallel and in concert with other similar includes.
2. The fix works, and any other choice does not
3. It is therefore, the correct way to "fix" the problem.

Additionally I am confident that this problem is not in any way related to Windows use of an Editor, as suggested by others, since my Notepad++ editor is set to UTC-8 encoding and has not been changed since I can remember. My thanks to Lennart for the iconv operations, those will become very useful at another time.

So what is causing the problem with Linux compiles? Perhaps Canne has identified the problem? (Please note that I have not yet succeed at getting Travis to complete, so I still have work to do.)
rgleason is offline   Reply With Quote
Old 03-07-2019, 00:57   #104
Registered User
 
Canne's Avatar

Join Date: Aug 2014
Posts: 246
Re: Twocan - a new Plugin

Dear both,

actually I don't know what is the problem, if there is one? In that case, it must be my magic touch which fixed it! Or maybe it was you, Rick? I just forked the repo, git cloned it on a Linux and it works, out of the box. I have no issue with Travis, either, I just checked, see https://github.com/canne/TwoCanPlugIn/commits/master both linux and osx are OK. Remind, I did not commit back from Linux box into my repo, so it is just as found after the GitHub fork.

It does not mean the problem is resolved. I can see in the comments special characters. Bad idea. Converting them to other encoding is a bad idea, too. I had this in 2015 when I ported tactics_pi to Linux: you need got get the author to recognize the issue and then offer help. Then, one must go through every file (I used emacs which has highly efficient find and replace functions with regular expressions etc.) and replace those evil characters with ASCII, like (R) as above with "registered trademark" string, and so on. Hey (the author), these are just comments, no need to make pretty print but to communicate with fellow programmers and to avoid trouble, 7-bit ASCII is enough for that...

But it is not over: One needs to go through the code and search the troublemakers in the string definitions. They should be replaced with "\uXXXX" unicode espace string to make them portable. If they are in the ("") macro, convert them to something more universal, can be language dependent, of course. This is needed to keep the code portable.

Going through the code is so much effort that there is no point to engage the work if the author has not accepted the principle in advance and can wait the pull request.

Cheers,

Petri
Canne is offline   Reply With Quote
Old 03-07-2019, 06:18   #105
Registered User
 
rgleason's Avatar

Join Date: Mar 2012
Location: Boston, MA
Boat: 1981 Bristol 32 Sloop
Posts: 17,753
Images: 2
Re: Twocan - a new Plugin

This is a followup to Canne's post regarding my repository "twocan-test"

Note: My repository has moved the actual plugin files (src, po, inc, etc) back up to the standard location rather than having them in a "plugin" sub folder. The reason for this move is so that windows NSIS packaging will work properly and installation files will be build properly.

As a result, I found I had to change the path to one of the #includes.
in src/twocanerror.cpp line 27 as follows:
Quote:
#include "../inc/twocanerror.h"

This matches many of the other includes in other src files.

Now appveyor builds successfully https://ci.appveyor.com/project/rgle...uilds/25719995 leaving an artifact https://ci.appveyor.com/project/rgle...9995/artifacts



Also one of the Travis builds does complete. https://travis-ci.org/rgleason/twoca...m=notification

C++ Travis 5.2 completes https://travis-ci.org/rgleason/twoca...jobs/553731417 and almost saves a pkg file.


gcc C++ 5.1 fails on another different error...
Quote:
-DNDEBUG -fPIC -Wall -Wno-unused-result -g -O2 -fexceptions -fPIC -std=gnu++11 -o CMakeFiles/twocan_pi.dir/src/twocansocket.cpp.o -c /home/travis/build/rgleason/twocan-test/src/twocansocket.cpp
/home/travis/build/rgleason/twocan-test/src/twocansocket.cpp:29:26: fatal error: twocansocket.h: No such file or directory
#include <twocansocket.h>
^
compilation terminated.
make[2]: *** [CMakeFiles/twocan_pi.dir/src/twocansocket.cpp.o] Error 1
make[2]: Leaving directory `/home/travis/build/rgleason/twocan-test/build'
make[1]: *** [CMakeFiles/twocan_pi.dir/all] Error 2
Which I think I can fix.

---------
See earlier commit with

in src/twocanerror.cpp line 27 as follows:
Quote:
#include "twocanerror.h"

Repository https://github.com/rgleason/twocan-test
This is with the incorrect include, as originally written, showing the failures.

Appveyor compile https://ci.appveyor.com/project/rgle...uilds/25649707
Quote:
C:\project\twocan_pi\src\twocanerror.cpp(27): fatal error C1083: Cannot open include file: 'twocanerror.h': No such file or directory [C:\project\twocan_pi\build\twocan_pi.vcxproj]
15 Warning(s)
1 Error(s)


Two Travis compiles https://travis-ci.org/rgleason/twocan-test
GCC https://travis-ci.org/rgleason/twoca...jobs/552548775
Quote:
/home/travis/build/rgleason/twocan-test/src/twocanerror.cpp:27:25: fatal error: twocanerror.h: No such file or directory
#include "twocanerror.h"

C++ https://travis-ci.org/rgleason/twoca...52548776#L2164
Quote:
/Users/travis/build/rgleason/twocan-test/src/twocanerror.cpp:27:10: fatal error: 'twocanerror.h' file not found
#include "twocanerror.h"
^~~~~~~~~~~~~~~
1 error generated.
Petri, I will try to do as you suggest below, next, to this repos.


Using Notepad++ to find non ascii see
https://www.datagenx.net/2015/12/not...non-ascii.html
rgleason is offline   Reply With Quote
Reply

Tags
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
New IAC Fleetcode Plugin for OpenCPN CBorchardt OpenCPN 77 23-04-2019 05:40
Plugin development... How to receive chart objects in my plugin? dmartinez OpenCPN 6 04-08-2017 00:56
New History Plugin for OpenCPN seandepagnier OpenCPN 11 04-10-2010 14:11

Advertise Here


All times are GMT -7. The time now is 05:25.


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.