# How to control Servos via UAVCAN?

**URL:** <https://forum.opencyphal.org/t/how-to-control-servos-via-uavcan/1073>\
**Category:** Applications & Usage\
**Created:** [January 11, 2021, 6:34pm UTC](https://forum.opencyphal.org/t/how-to-control-servos-via-uavcan/1073 "2021-01-11T18:34:44Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![max11gen](https://forum.opencyphal.org/letter_avatar_proxy/v4/letter/m/db5fbb/32.png) [@max11gen](https://forum.opencyphal.org/u/max11gen)\
**Post date:** [January 11, 2021, 6:34pm UTC](https://forum.opencyphal.org/t/how-to-control-servos-via-uavcan/1073/1 "2021-01-11T18:34:44Z")

</div>

I’m working on a project to build a coax helicopter with 6 servos. I am planning to use the PX4 Autopilot on a Pixhawk 4 FCU. What do I need to control the servos via UAVCAN?

So far I thought of two options:

1. Ordering the [UC4H hardware](https://store.jdrones.com/uavcan) from jdrones/[OlliW](http://www.olliw.eu/2017/uavcan-for-hobbyists/). As far as I understood it, I can use the Gen-node to control the servos, right?
2. Ordering servos that can be controlled by UAVCAN natively. This is not an option for me, because I already have quite expensive servos from FUTABA which can be controlled via S.BUS but not UAVCAN.

So, I would like to know if my first option would work and also if there are any other options, that I couldn’t come up with. Thank you very much in advance.

---

<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:** [January 11, 2021, 6:41pm UTC](https://forum.opencyphal.org/t/how-to-control-servos-via-uavcan/1073/2 "2021-01-11T18:41:40Z")

</div>

UAVCAN v0 is currently in the legacy maintenance mode and it will see no further development. New projects should adopt UAVCAN v1, which rules out UC4H. The PX4 team is currently working on supporting UAVCAN v1 and it is expected to be available in the foreseeable future (I am not in a position to provide any estimates, it’s best to consult with the PX4 devs directly).

For interfacing your analog servos with UAVCAN consider building an adapter node based on [**107-Arduino-UAVCAN**](https://www.arduino.cc/reference/en/libraries/107-arduino-uavcan/). You will find relevant documentation on the project page and also on this forum (use search):

> [@Hardware example using UAVCAN v1 on Arduino](https://forum.opencyphal.org/t/hardware-example-using-uavcan-v1-on-arduino/1052):
>
> The [107-Arduino-UAVCAN](https://github.com/107-systems/107-Arduino-UAVCAN) library is now at a point where it can be used to make small working projects and here is an example how to do it. This example uses unregulated Subject-IDs. Register API is not yet implemented in the library so the Subject-IDs are coded in the Arduino sketch. The example generates a Heartbeat message every second. My example uses an [Arduino MKR WiFi 1010](https://store.arduino.cc/arduino-mkr-wifi-1010) with a [MKR CAN Shield](https://store.arduino.cc/arduino-mkr-can-shield). The Arduino has a builtin LED and two more LEDs are connected to pin 2 and 5. A tactile switc…

---

<div class="post-metadata">

**Author:** ![max11gen](https://forum.opencyphal.org/letter_avatar_proxy/v4/letter/m/db5fbb/32.png) [@max11gen](https://forum.opencyphal.org/u/max11gen)\
**Post date:** [January 12, 2021, 4:21pm UTC](https://forum.opencyphal.org/t/how-to-control-servos-via-uavcan/1073/3 "2021-01-12T16:21:36Z")

</div>

Thanks a lot for your help, @pavel.kirienko!

If I understand this correctly, the 107-Arduino-UAVCAN library will currently not work with PX4, because PX4 doesn’t support UAVCAN v1 yet, right? So I would have to wait and possibly contact the PX4 development team, if they can provide any insights on when they will release UAVCAN v1 support.

Once PX4 rolls out v1 support: What options will I have to control my servos with UAVCAN v1 or more specifically what parts can I buy? I guess the 107-Arduino-UAVCAN project doesn’t really support this as on the post you linked it’s written that it only supports “uavcan.primitive.scalar.Bit.1.0” messages

---

<div class="post-metadata">

**Author:** ![aentinger](https://forum.opencyphal.org/user_avatar/forum.opencyphal.org/aentinger/32/1428_2.png) [@aentinger](https://forum.opencyphal.org/u/aentinger)\
**Post date:** [January 13, 2021, 6:46am UTC](https://forum.opencyphal.org/t/how-to-control-servos-via-uavcan/1073/4 "2021-01-13T06:46:04Z")

</div>

Hi @max11gen 👋

As [107-Arduino-UAVCAN](https://github.com/107-systems/107-Arduino-UAVCAN) uses the C files generated via [nunavut](https://github.com/UAVCAN/nunavut) from all currently available UAVCAN types specified in [public\_regulated\_data\_types](https://github.com/UAVCAN/public_regulated_data_types) you can in fact use any UAVCAN type with this Arduino library - if you are generating the C headers for your specific type yourself (see [here](https://github.com/107-systems/107-Arduino-UAVCAN/wiki)).

Independent of that there is currently [some effort underway](https://github.com/107-systems/107-Arduino-UAVCAN/pull/65) to support all uavcan types out-of-the box in the future.

---

<div class="post-metadata">

**Author:** ![max11gen](https://forum.opencyphal.org/letter_avatar_proxy/v4/letter/m/db5fbb/32.png) [@max11gen](https://forum.opencyphal.org/u/max11gen)\
**Post date:** [January 13, 2021, 8:07am UTC](https://forum.opencyphal.org/t/how-to-control-servos-via-uavcan/1073/5 "2021-01-13T08:07:52Z")

</div>

Hi @aentinger and thank you for your help, too! That is indeed a great hint. Just out of curiosity (to improve my understanding of open source development): If it is so easy to generate the headers for all UAVCAN types, why don’t you just integrate the support for all types in the repo?

However, I really need a solution that enables me to control my servos via UAVCAN with a PX4. So if anyone has any hints for that I would be very happy.

@pavel.kirienko I searched for any kind of anouncement from PX4 about integrating UAVCAN v1, but I couldn’t find anything. Can you link me to something, or do you just happen to know that, because you are in close contact with the dev team?

---

<div class="post-metadata">

**Author:** ![aentinger](https://forum.opencyphal.org/user_avatar/forum.opencyphal.org/aentinger/32/1428_2.png) [@aentinger](https://forum.opencyphal.org/u/aentinger)\
**Post date:** [January 13, 2021, 8:58am UTC](https://forum.opencyphal.org/t/how-to-control-servos-via-uavcan/1073/6 "2021-01-13T08:58:37Z")

</div>

It is possible - but not desirable as highlighted by @pavel.kirienko [here](https://github.com/107-systems/107-Arduino-UAVCAN/pull/65#discussion_r555137155). We are currently evaluating possible solutions such as a web-service to convert DSDS into Arduino headers easily. This would mandate to first extend nunavut to generate the Arduino headers/wrappers which so far have been implemented manually, such as [Heartbeat.1.0.hpp](https://github.com/107-systems/107-Arduino-UAVCAN/blob/all-uavcan/src/types/uavcan/node/Heartbeat.1.0.hpp). How’s your Python 😀?

---

<div class="post-metadata">

**Author:** ![max11gen](https://forum.opencyphal.org/letter_avatar_proxy/v4/letter/m/db5fbb/32.png) [@max11gen](https://forum.opencyphal.org/u/max11gen)\
**Post date:** [January 14, 2021, 11:00am UTC](https://forum.opencyphal.org/t/how-to-control-servos-via-uavcan/1073/7 "2021-01-14T11:00:56Z")

</div>

@aentinger Unfortunately, my python is quite poor 😃

If I used v1.0.3 of 107-Arduino-UAVCAN for now I can use it with PX4, because you just adapted to UAVCAN v1 on your release v1.1, right? So that would mean I would just need to get some Arduinos + CAN-Shields and implement the code to control the servos on them, right?

---

<div class="post-metadata">

**Author:** ![aentinger](https://forum.opencyphal.org/user_avatar/forum.opencyphal.org/aentinger/32/1428_2.png) [@aentinger](https://forum.opencyphal.org/u/aentinger)\
**Post date:** [January 14, 2021, 1:17pm UTC](https://forum.opencyphal.org/t/how-to-control-servos-via-uavcan/1073/8 "2021-01-14T13:17:19Z")

</div>

Unfortunately that’s not how it works 😉 Versioning of **107-Arduino-UAVCAN** is independent of UAVCAN versioning. You can see the changelog between the versions [here](https://github.com/107-systems/107-Arduino-UAVCAN/releases), but I can assure you that its all only **UAVCAN V1** (sorry).

---

<div class="post-metadata">

**Author:** ![max11gen](https://forum.opencyphal.org/letter_avatar_proxy/v4/letter/m/db5fbb/32.png) [@max11gen](https://forum.opencyphal.org/u/max11gen)\
**Post date:** [January 14, 2021, 5:02pm UTC](https://forum.opencyphal.org/t/how-to-control-servos-via-uavcan/1073/9 "2021-01-14T17:02:44Z")

</div>

@aentinger Ah ok. I had seen the changelog already. I thought, that everything before version 1.1.0 was using UAVCAN v0, because in the changelog you wrote for 1.1.0 that you now updated to UAVCAN v1.0beta. But looking at the release history of UAVCAN now, I guess that you meant updating from UAVCAN v0.2 or v0.100 to v1.0…
