OpenCyphal / yakut

Simple CLI tool for diagnostics and debugging of Cyphal networks
https://opencyphal.org
MIT License
49 stars 10 forks source link

Yakut pub/sub/client should allow specifying the subject/service by name/ID instead of separate port-ID and type #45

Closed pavel-kirienko closed 2 years ago

pavel-kirienko commented 2 years ago

Instead of this:

yakut sub 33:uavcan.si.unit.angle.Scalar.1.0

I want to be able to say this:

yakut sub angle

Yakut should go ask every online node if there are registers named uavcan.pub.angle.id and uavcan.pub.angle.type. If there are multiple nodes with that register and the port-IDs don't match, report an ambiguity error and ask the user to clarify which specific node is of interest:

yakut sub angle@123

If all nodes share the same port configuration, pick the first one whose data type is known to the local Yakut instance and subscribe to that.

This resembles the experience with traditional pub/sub frameworks with decentralization.

The same applies to yakut publish. The case of yakut call is simpler because we already have the node-ID to work with, hence we won't have to scan the network to find the service-ID.

Further, I want to be able to specify the port-ID only and omit the type, letting Yakut infer the type automatically:

yakut sub 33

In this case, it will have to subscribe to this topic using uavcan.primitive.Empty.1.0 (relying on structural subtyping) and observe which nodes publish on this topic. Then scan the registers and determine the type. Then re-subscribe using the new type. Eventually, we should extend the standard node API that allows querying the type from ID without the need to fetch all registers.

The same applies to yakut publish.