# New node type proposal: Control reception

**URL:** <https://forum.opencyphal.org/t/new-node-type-proposal-control-reception/1863>\
**Category:** Applications & Usage\
**Created:** [April 5, 2023, 3:03am UTC](https://forum.opencyphal.org/t/new-node-type-proposal-control-reception/1863 "2023-04-05T03:03:01Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![pavel.kirienko](https://forum.opencyphal.org/user_avatar/forum.opencyphal.org/pavel.kirienko/32/9_2.png) [@pavel.kirienko](https://forum.opencyphal.org/u/pavel.kirienko)\
**Post date:** [April 9, 2023, 6:14am UTC](https://forum.opencyphal.org/t/new-node-type-proposal-control-reception/1863/2 "2023-04-09T06:14:22Z")

</div>

Hi David! Thank you for starting this thread, and apologies for taking my time to get back to you – am traveling.

As I indicated [on Matrix](https://opencyphal.org/chat), this matter is of interest but it is outside of the scope of the Cyphal standard (which is not to say that it can’t be discussed on this forum). Some time ago one would have said that it is within the domain of UDRAL, but UDRAL itself is currently being transferred to a completely separate effort that is maintained on GitHub here by @Dima:

> **[GitHub - DS-015/ds015: Interface definition files for the DS-015 drone...](https://github.com/DS-015/ds015)**
>
> Interface definition files for the DS-015 drone standard

Hence what we are discussing here is within the domain of DS-015. You will see that many of your valid concerns are already sensibly addressed by Cyphal out of the box.

> [@The\_Alchemist](#):
>
> Of note, I’m not sure how to make precision flexible using the example standard data types; in this example, I’ve hard-coded 2 precision levels. Compared to existing standards that use 11-13 bits of data for control channel data, this is higher precision, so uses more bandwidth/larger packet size than required.

In Cyphal, one should normally tend towards clarity and simplicity over bandwidth optimization. The idiomatic approach here is to use fixed larger types, like `int16` or `float32` (or `float16` if you can tolerate ~10 bit resolution), for all analog channels. Variable-width encoding is not supported in Cyphal (nor DroneCAN). The topic of good interface design is covered at length in [the Guide](https://opencyphal.org/guide).

> [@The\_Alchemist](#):
>
> Downsides of the above:  
> \<…\>
> 
> - impossible to add new data types or telemetry items without defining entire new frames.
> - and change breaks backwards compatibility and introduces run-time or compile-time logic into flight-controller codebase.
> - looks to the past, only at what exists now, not the future which stifles development and experimentation possibilities.

Cyphal (unlike DroneCAN) allows you to _add/remove fields to a data type definition without breaking backward compatibility_. Practical examples are covered both in the Guide linked above and in the [Specification, section 3.8 “Compatibility and versioning”](https://opencyphal.org/specification). This feature has limitations but the use case you outlined could serve as a perfect example of data type versioning.

> [@The\_Alchemist](#):
>
> By default, the node is silent. The entity receiving data (eg flight controller) submits a _discovery_ request. The Rx responds with a list of information it can supply, including channel indices, available resolutions, and available data rates for each channel. Given this info, the FC can choose which info it wants to receive based on the Rx’s capabilities, which it knows due to the response to _discovery_. The subscribe request will always succeed, since the flight controller has the information it needs to make it.

On the high level, this description begs the objection of being too stateful and complex. Some systems are certain to benefit from the added flexibility, while others where functional safety guarantees are of interest will be difficult to reconcile with it. For an in-depth discussion, refer to the section of the Guide dedicated to stateful interfaces.

However, if you choose to express your configurables via dedicated topics, you will see that the logic you described can be implemented in Cyphal _(not DroneCAN)_ out of the box without the need to reinvent custom negotiation protocols. The key here is to choose a particular topic naming format that encodes the required information in the topic name. For example, `channels_0to8_13bit_200hz`, etc (this is just a crude example; at this point I see little reason to segregate options by resolution). Then, in the case of a high-integrity system, the integrator will be able to choose one (or several) topic once and configure it manually, while in the case of a more flexible PnP scenario the flight controller would simply list the available topics and find the one that suits its configuration best, and then enable it selectively. The other topics would remain, of course, unused, thus consuming zero resources from the network and from the publisher node.

A closely related topic is that of the PnP node configuration. Please read this:

> [@Port type safety enforcement](https://forum.opencyphal.org/t/port-type-safety-enforcement/1303/9):
>
> Took me a while but the PoC is now ready. It’s a bit crude but I hope it’s good enough to illustrate the concept: It is a mix of the original idea I shared at [Automatic configuration of port identifiers - #7 by pavel.kirienko](https://forum.opencyphal.org/t/automatic-configuration-of-port-identifiers/840/7) and the cookie register I mentioned in the previous post. Before I explain how it works, let me explain its behavior. What it does You can grab the demo from the repo, install Yakut (pip install yakut), and run it: yakut compile -O . https://github.com/UAVCAN/public\_r…

You can further enhance your message definition somewhat to take advantage of the different, receiver-defined update rates per channel (and possibly resolution, although as I said earlier this may not be justifiable). To do this, you could define a separate data type that carries the channel value and its index, let’s call it `Channel.1.0`:

```python
# Channel.1.0
uint8 channel_index
Value.1.0 value
@extent 64

```

In the fixed-resolution case, `Value.1.0` would be simply a native numeric type like `int16` or `float32`. In the variable-resolution case, you would make it a union like this:

```python
# Value.1.0
@union
uint16 high_resolution
uint8 low_resolution
@sealed

```

Then you fold it into an array in the top-level type that is actually published by the receiver:

```python
Channel.1.0[<=16] channels
# The array contains only those channels that are updated in this cycle.

```

To compensate for the possible message loss, the receiver could force an update every 100 ms or so regardless of whether there’s been an actual change.

> [@The\_Alchemist](#):
>
> Of note, I think for many cases of channel data, 2+ frames may be required on FDCAN. If this addition is made available for basic CAN, multi-frame packets would be required in all cases. This begs the question: Should this be backwards compatible with basic CAN, or should it be FDCAN only? Suggested approach: A discovery agreement between the Rx and FC, allowing either to be used. The subscriber can choose the frame format (CAN/FDCAN) too.

Cyphal does not distinguish between Classic CAN and CAN FD (sic, FDCAN is not the correct spelling and may hinder forum searchability). As a designer of the network service, you should focus on the higher-level objectives and leave the matter of transport management to the transport layer. I recommend that you think in terms of network services, domain objects, and topics, and purposefully forget about the low-level aspects until the final stages of the design process.

---

_[View the full topic](https://forum.opencyphal.org/t/new-node-type-proposal-control-reception/1863)._
