edgetx icon indicating copy to clipboard operation
edgetx copied to clipboard

Logs: reset telemetry sensor data to inital state if telemetry is not streaming

Open mha1 opened this issue 1 year ago • 19 comments

After loosing telemetry all sensor values will be frozen at the last valid value. This is nice feature that can be used to retrieve the last known GPS position of a crashed model by e.g. looking at the model settings/telemetry screen. However logging frozen values doesn't make much sense as they give the impression of live recorded data.

image

This PR clears the sensor data written to the log file to their initial state in case telemetry is not streaming. That makes it easy to spot "no live telemetry" phases in the log file or log charts.

image

mha1 avatar Dec 03 '23 16:12 mha1

Probably the wrong way tof doing it, since it only addresses telemetry lost and not sensor lost, and many parsers don't like missing columns...

3djc avatar Dec 03 '23 16:12 3djc

In addition, in case things go really bad, you might want to have a look at any piece of data you have, you might not have valid telemetry indication, but still get bits of data, you probably want those logged

3djc avatar Dec 03 '23 16:12 3djc

Probably the wrong way tof doing it, since it only addresses telemetry lost and not sensor lost, and many parsers don't like missing columns...

Sensor lost: valid comment, a lost sensor should be cleared while telemetry is streaming

Missing columns: what makes you believe there would be missing columns? There are no missing columns, values just change, e.g. live RxBt 11.2V, after telemetry lost 0,0V, after telemetry recovered 11.2V

In addition, in case things go really bad, you might want to have a look at any piece of data you have, you might not have valid telemetry indication, but still get bits of data, you probably want those logged

The only thing I believe you are talking about might be calculated sensors. All calculated sensors have "live" sensors as input. Multiply or add or any other math on frozen values will only give you a meaningless new frozen value. If I am wrong please provide a plausible example of usable "bits of data" from a period where telemetry is not streaming.

mha1 avatar Dec 03 '23 17:12 mha1

added clearing of sensor data when sensor is lost while telemetry is streaming

A4: sensor lost while telemetry is streaming (A2 remains live), A4 resuming, followed by a telemetry loss (both A2 and A4 are no longer live)

image

MODEL02-2023-12-03-165134.csv: no empty columns if sensor lost or telemetry not streaming apart from GPS which is the standard unchanged behavior for initial GPS data (0.0, 0.0).

mha1 avatar Dec 03 '23 18:12 mha1

This reminds me that I never pushed changes where we update sensors even if telemetry is not streaming ( So no valid rssi or similar). This comes from a past where there was basically no crc on anything. Nowadays, there is no reason not to update a sensor when a valid packet is received, even if no rssi packet has been received recently for whatever reason

3djc avatar Dec 03 '23 20:12 3djc

This reminds me that I never pushed changes where we update sensors even if telemetry is not streaming ( So no valid rssi or similar). This comes from a past where there was basically no crc on anything. Nowadays, there is no reason not to update a sensor when a valid packet is received, even if no rssi packet has been received recently for whatever reason

In general you need some sort of "receiver alive" status to determine stuff like receiver connected messages when trying to power down the radio. Currently TELEMETRY_STREAMING() delivers that status and it is entirely up to the protocol to set this to "yes, I think the receiver is alive" or "receiver not alive". Currently all (I think) of the protocols use a some sort of representation of link quality (RSSI, RQly, ...) to decide if they believe the receiver is up and running. Nothing is stopping the protocols to have a more complex logic to use data from arbitrary packets or even just packet counters.

mha1 avatar Dec 04 '23 09:12 mha1

stalling

mha1 avatar Jan 05 '24 19:01 mha1

@pfeerick this should be a small fish for you to fry

mha1 avatar Jan 07 '24 06:01 mha1

@pfeerick any spare time to discuss or even to decide this?

mha1 avatar Jan 19 '24 11:01 mha1

anybody home?

mha1 avatar Jan 26 '24 15:01 mha1

Just an observation while reading the code: (Still have to test it)

if you clear the telemetryItem when loosing telemetry streaming, auto-offset sensors will be re-started. For example, absolute altitude will start computing from the altitude is restore telemetry, not from the ground as intended. Probably similar case with GPS distance from Home.

frankiearzu avatar Feb 04 '24 10:02 frankiearzu

Just an observation while reading the code: (Still have to test it)

if you clear the telemetryItem when loosing telemetry streaming, auto-offset sensors will be re-started. For example, absolute altitude will start computing from the altitude is restore telemetry, not from the ground as intended. Probably similar case with GPS distance from Home.

Thanks for reanimating this discussion. The way this PR is intended to work is to write cleared data to log files in case of no dead telemetry or lost sensors. No general reset of any telemetry items. So auto offset should not be affected. Please test you use case an let me know.

mha1 avatar Feb 04 '24 14:02 mha1

if you clear the telemetryItem when loosing telemetry streaming, auto-offset sensors will be re-started. For example, absolute altitude will start computing from the altitude is restore telemetry, not from the ground as intended.

I built simu for this PR and tried your use case.

Alt is defined as auto offset sensor and telemetry started with an initial Alt value of 125m, resulting in an auto-offset of 125m and a sensor Alt value of 0m as expected.

image

Changing Alt to 127m results in an Alt sensor value of 2m as expected

image

Stopping the telemetry data stream results in a red Alt sensor and the well known "telemetry lost" message. The sensor value is frozen and remains at 2m as expected

image

Starting the telemetry data stream again (with just for fun assuming Alt has changed to 129m in the meantime) results in a live Alt sensor showing 4m as expected. The auto offset value is still at its initially calculated value of 125m

image

mha1 avatar Feb 04 '24 16:02 mha1

@pfeerick this dry-aged quite a bit. no like it?

mha1 avatar Mar 06 '24 03:03 mha1

It's likely a 2.11 problem, so just not there yet.

pfeerick avatar Mar 06 '24 03:03 pfeerick

Will start thinking about this soon now... any day now :zany_face:

pfeerick avatar Apr 05 '24 07:04 pfeerick

any day of which year?

mha1 avatar Apr 05 '24 21:04 mha1

if you can't make any day any night would be fine too

mha1 avatar Apr 10 '24 07:04 mha1

@pfeerick Dude ...

mha1 avatar Apr 19 '24 16:04 mha1

Hallelujah

mha1 avatar May 31 '24 00:05 mha1