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

Introduce Link Statistics and Latency Measurement #477

Closed
wants to merge 9 commits into from

Conversation

gemenerik
Copy link
Member

This PR introduces a framework for link statistics, enabling the tracking of various metrics, starting with latency measurement.

  • LinkStatistics Class: A new class to manage multiple types of link statistics, facilitating the addition of more metrics in the future.
  • Latency Measurement: A dedicated Latency class is introduced to send periodic ping requests to the Crazyflie. It calculates the round-trip latency and maintains the 95th percentile (p95) latency over recent measurements.

The implementation improves the lib's ability to monitor communication quality and lays the groundwork for further enhancements in link statistics.

- Moved latency measurement from the radio driver to a new Latency class for better organization and readability.
- Generalized the LinkStatistics class to allow for easy addition of other link statistics in the future.
@gemenerik
Copy link
Member Author

If you want to play around with it, I suggest printing in the _ping_response method

@gemenerik gemenerik marked this pull request as ready for review September 26, 2024 10:48
In a valiant attempt to appease the relentless gods of autopep8 and the all-seeing eyes of CI, I embarked on an epic journey to fix double-quoted strings and reorder imports.
@knmcguire
Copy link
Member

connected to #469

- Modified start() and stop() methods for better thread management.
- Implemented thread reinitialization on start after stop.
@knmcguire
Copy link
Member

Anyway to attach a caller to this for this so that we can do a callback for each Crazyflie instance? Trying to find a good example to do that in a good way... the only one I could think of is the link_quality_callback but that's perhaps not the same level

@gemenerik
Copy link
Member Author

I would also like to discuss, before we merge, the ping interval, how many measurements we store, and if p95 is the best option

@gemenerik
Copy link
Member Author

Anyway to attach a caller to this for this so that we can do a callback for each Crazyflie instance? Trying to find a good example to do that in a good way... the only one I could think of is the link_quality_callback but that's perhaps not the same level

Something like a Caller that you can attach a callback to for when a new latency value has arrived? I think cflib/crazyflie/console.py is a neat example of this. Or do you mean something else?

@knmcguire
Copy link
Member

Ah yes the console is a good option indeed. It's just that printing in a different thread gives issues sometimes, and I'd like to test it out with crazyswarm2 as well.

@gemenerik
Copy link
Member Author

Ah yes the console is a good option indeed. It's just that printing in a different thread gives issues sometimes, and I'd like to test it out with crazyswarm2 as well.

Yeah I think adding a Caller could be neat, we can use it to update some UI feature in the client too. I can add it.

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

Successfully merging this pull request may close these issues.

3 participants