Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wrong value display on rudder angle (SK) and no display on N2K #11

Closed
aviatorhh opened this issue May 6, 2024 · 13 comments
Closed

Wrong value display on rudder angle (SK) and no display on N2K #11

aviatorhh opened this issue May 6, 2024 · 13 comments

Comments

@aviatorhh
Copy link

When serving "cansend vcan0 0DF10D0a#00000000451b0000" (0x451b) SK displays "steering.rudderAngle" with value of 0.6981 and makes it to:
Screenshot 2024-05-06 at 13 53 12
but on OpenCPN it shows
Screenshot 2024-05-06 at 13 53 31
As I tested with SK and N2K I can say that the value is coming from SK only.

@TwoCanPlugIn
Copy link
Owner

From a quick perusal of the code, a couple of observations.

For rudder angle, the engine dashboard only supports SignalK (steering.rudderAngle) and NMEA 0183 (RSA).

Can't recall why I omitted the NMEA 2000 PGN 127245 when I updated the plugin to support the last version of OpenCPN. Something to add in the next release.

Nonetheless, definitely something weird with the SignalK parsing.

On lines 810

if (update_path.StartsWith(_T("steering.rudderAngle"))) {
	SendSentenceToAllInstruments(OCPN_DBP_STC_RSA, RADIANS_TO_DEGREES(GetJsonDouble(value)), _T("\u00B0"));
}

I wonder if there is a problem with the GetJsonDouble function ? Needs a little bit of debugging I guess.

Unfortunately I'm travelling so don't have my SignalK Server to hand, so unable to investigate for the next week or so.

Thanks.

@TwoCanPlugIn
Copy link
Owner

Now that I think about it, the plugin does need a semi-major update. I guess a summer project to keep it in synch with the forthcoming OpenCPN 5.10 release.

The last release still relied on the "old" OpenCPN messaging framework for SignalK, because for version 5.8 they had omitted the GetSignalkPayload function !

@aviatorhh
Copy link
Author

Understood. I can fix the rudder stuff if you like and include it in my PR. I am not sure when but maybe next week.

@TwoCanPlugIn
Copy link
Owner

I'll do it.

I'll also add the NMEA 2000 PGN 127245 stuff (that's essentially cut-n-paste from the twocan code base).

Just can't verify the SignalK fix/behaviour until I return and plugin the SignalK Server.

Thanks very much for finding & fixing the bugs.

@aviatorhh
Copy link
Author

And wrong direction :-)
IMG_4003 Medium
IMG_4004 Medium
Screenshot 2024-05-08 at 17 23 00

@aviatorhh
Copy link
Author

I'll do it.

I'll also add the NMEA 2000 PGN 127245 stuff (that's essentially cut-n-paste from the twocan code base).

Just can't verify the SignalK fix/behaviour until I return and plugin the SignalK Server.

Thanks very much for finding & fixing the bugs.

I can see that N2K now is working but the accuracy still is bad ;-)

@TwoCanPlugIn
Copy link
Owner

TwoCanPlugIn commented May 26, 2024 via email

@TwoCanPlugIn
Copy link
Owner

I think I've found the causes of the problems.

Hopefully now fixed in v1.81

Invalid (aka incorrect values) seemed to be caused by the macro definition for converting radians to degrees.

Changed from
#define RADIANS_TO_DEGREES(x) (x * 180 / M_PI)
to
#define RADIANS_TO_DEGREES(x) ((x) * 180 / M_PI)

Apparently the macro expansion caused the problem.

And for displaying the incorrect position (port vs starboard), I may have broken it when I added support for "text" tank gauges and changed the DASH_CAP enum but didn't change the signature for the RudderAngle SetData function. (Or perhaps it was always broken !)

Changed from
void SetData(int, double, wxString);
to
void SetData(DASH_CAP, double, wxString);

Hopefully fixed.

If you can also verify, feel free to close the issue.

And thanks for your help on the engine hours fix.

@aviatorhh
Copy link
Author

Hm, I tried on OSX (SK) where the needle is now not moving at all.
On my Linux machine it is moving neither via SK nor N2K. Have not debugged it yet. I can test it live on a RPi in about 10 days.
I am not sure but it seems like I have seen a very short needle jump once.

@TwoCanPlugIn
Copy link
Owner

Seems to be working OK on my testbed.

Running OpenCPN on Windows.
Being fed with simulated data from either of the following sources.
NMEA 0183 over UDP
NMEA 2000 over serial
and SignalK running on a RaspberryPI which is being fed by NMEA 2000 over SocketCAN.

A couple of observations.
More of a historical artifact than anything else, the rudder uses the same watchdog as fluid levels. At the time the rudder angle gauge was added to the plugin, it was well after the tank gauges had been implemented and a change to the enums would have broken existing configurations. The work around to stop the rudder gauge being zeroed is to send some tank level values. I guess this should be fixed, either change the enums or give the rudder its own watchdog.

Also noticed that SignalK is not sending engine hours (eg. propulsion.port.runTime values), even though they are being sent through the SocketCAN interface and are parsed by canboat analyzer.
Eg. candump vcan0 | candump2analyzer | analyzer 129489 shows the presence of total engine hours, yet nothing shows in the SignalK Data Browser.

Finally if you are feeding SignalK using NMEA 0183, then the engine dashboard doesn't display anything. This is because SignalK is using a different namespace for engine data received by NMEA 0183 (eg. XDR & RPM sentences) vs engine data received over NMEA 2000. Refer to the following SignalK issue/bug.

Oh, and if nothing is showing, even if it seems it should, check that the engine dashboard preferences are correctly set for single or dual engine as appropriate.

Let me know if you make any further progress.

@aviatorhh
Copy link
Author

I do confirm a working RA display while sending tank values now and I can tell even sending RSA values (e.g. $SPRSA,-35.0,A,,,*1B) to SK transforms to a valid path and is displayed.
On my side I can see runTime information via N2K/SK. I have built an ECU for my engine that sends out all the data. My reference for N2K packets is based on canboat.
I am happy with your fix :)

@aviatorhh
Copy link
Author

BTW, something changed on the PluginConfigure cmake mechanism. On my side cmake does not find wxWidgets on my win and osx environments. I am not sure if this is an issue on my side but I will check.

@TwoCanPlugIn
Copy link
Owner

Yes, in addition to the bug fixes, I also had to update both cmake and the continuous integration (CI) files. I think because of the forthcoming release of OpenCPN 5.10

Welcome to the world of plugin development !

Since the development & release of OpenCPN 5.8 last year, with its dependence on a new version of wxWidgets, it broke everything. You spend 99% of your time fixing the build & CI environment. It's f....g frustrating hence why I begrudgingly update & fix the plugins. It's no longer fun.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants