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

Add getPath method to SendableBuilder #5505

Closed
wants to merge 1 commit into from
Closed

Add getPath method to SendableBuilder #5505

wants to merge 1 commit into from

Conversation

Gold856
Copy link
Contributor

@Gold856 Gold856 commented Aug 5, 2023

Designed to be equivalent to NTSendable's getTopic, but backend agnostic. It returns a string representation of the path where the properties will be placed, e.g. /Epochs/Scheduler or /SmartDashboard/Scheduler/Epochs. This allows for topics to be dynamically created. The implementing class would call getPath in initSendable and store the path in a member variable (actually two, one for NT and another for DataLog), and would use it with NT publishers and DataLog to publish values. It would be up to the implementing class to support all backends (I don't think delegating dynamic topics to SendableBuilder is the right path). Unblocks #5375.

@Gold856 Gold856 requested review from PeterJohnson and a team as code owners August 5, 2023 00:01
@PeterJohnson
Copy link
Member

The point of Sendable/SendableBuilder is so that implementing classes don't need to know the backend. For example, wpimath classes cannot directly access the NT backend, because wpimath does not depend on ntcore. NTSendable exists so that the classes that do need that feature have a way to do so.

Sendable also allows for arbitrary placement (and even multiple placement, although some classes break this ability, particularly NTSendable-using classes).

@Gold856
Copy link
Contributor Author

Gold856 commented Aug 5, 2023

Maybe SendableBuilder could accept a lambda returning a Map<String, T>, where T is a type supported by SendableBuilder. When the builder is updated, it takes each map entry and publishes each with the string key as the topic name, and the value as the value. The implementing class doesn't need to know the backend, it just has to provide a map.

This doesn't solve Tracer's problem where it can't capture the timing of SmartDashboard.updateValues, but Tracer probably needs its own solution. This generally solves the problem of dynamic topics.

@calcmogul calcmogul added the component: telemetry High level telemetry functionality label Dec 2, 2023
@Gold856 Gold856 closed this Mar 3, 2024
@Gold856 Gold856 deleted the sendablebuilder-getpath branch March 3, 2024 08:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component: telemetry High level telemetry functionality
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants