larus-breeze / sw_sensor

Firmware for Larus sensor MK1 and MK2
3 stars 4 forks source link

Delete $HCHDM sentence in communication with XCSoar #30

Closed degeflija closed 1 year ago

degeflija commented 2 years ago

This sentence is obsolete. XCSoar is constructed to use the wind vector (its own or extern), geo coordinates and IAS -- to derive heading.

If the sentence $HCHDM is in the data stream, XCSoar ALWAYS uses this as heading, no matter what the the choice on wind is, no matter how wrong that data is.

XCSoar is better off without that sentence.

URGENT !!!

degeflija commented 2 years ago

After discussion with Klaus 👎: This senstence might be usefull when compass data are ALWAYS reliable, in particular when using a Dual GNSS. But even so in case of fallback : This sentence should be omitted when mag calibration is not good, Suggestions : Base this decision on a measured value - and/or decide it with a runtime adjustable parameter via CAN.

In the long run, i suggest the XCSoar driver permits an XCSoar configuration decision (analoguous to wind) "external or internal heading".

realtimepeople commented 2 years ago

If the heading information is wrong, all of the wind- vario- data etc are nonsense. The other way round: As long as the sensor works at all, heading data are way better the everything XCsoar can calculate. Therefore it absolutely makes sense to provide the HCHDM sentence to xcsoar.

degeflija commented 2 years ago

XCSoar can be configured to ignore external wind. In that case it calculates its own wind AND heading. However, it cannot be configured to ignore external heading, which in the given situation overwrites the internally calculated heading. This could be understood as an XCSoar issue. But the XCSoar situation is as it is. If - as is the current situation - the mag based heading is wrong, but is sent to XCSoar, XCSoar will show a crazy heading vector. My initial argument holds.

degeflija commented 2 years ago

Just insisting that the $HCHDM is always sent - no matter what the situation is - is certainly not a sustainable solution.

Assume the sensor sends accurate wind data, then XCSoar can calculate its heading without the sensor info in $HCHDM . Then the XCSoar result for heading certainly will be no less accurate than the sensor info in $HCHDM. Ergo $HCHDM brings no additional accuracy. It is obsolete.

Assume the wind data is NOT accurate - and XCSoar is configured to calculate its own wind, then XCSoar calculates its own wind and heading info. And again the $HCHDM sentence is not needed. It MUST NOT be sent, as it would deteriorate the situation.

So far, I just see no valid use case for $HCHDM.

Things might get foggy, when the sensor shifts between reliable wind data and non-reliable wind data - due to erroneous mag field measurement and /or calibration, due to sat malfunctions.

realtimepeople commented 1 year ago

The NMEA output has been reworked. The $HDHCM record has been removed.