107-Arduino-Cyphal: A libcanard based OpenCyphal implementation for Arduino

Hello everyone :coffee: :wave:

I’d like to announce the availability of 107-Arduino-Cyphal via Arduino Library Manager.

This library is the successor of 107-Arduino-UAVCAN.

It’s purpose is to provide a libcanard based OpenCyphal implementation for various Arduino platforms and was made necessary due to the renaming of the project. Furthermore the occasion was used to facelift the library, i.e. update to the latest versions of libcanard/o1heap as well as various other minor improvements (see changelog).

Cheers, Alex

4 Likes

Bravo! Thank you @aentinger for this exciting contribution.

1 Like

Hi everyone :coffee: :wave:

Just a short heads-up that adding a convenient register API is underway (#158) for 107-Arduino-Cyphal. Here a short sneak-preview:

CC @generationmake

2 Likes

Hi
I have already tested it and it seems to work for read and write operations. So best to configure your nodes.
examples will follow!
Bernhard

2 Likes

pretty cool! Cant wait to test it

1 Like

With the release of 107-Arduino-Cyphal:v2.2.0 a convenient C++ API for dealing with the OpenCyphal Register feature has been added to the Arduino library.

Here’s how to use 107-Arduino-Cyphal’s register API:

First instantiate a couple of registers (plus a RegisterList object) which you’d like to use:

RegisterNatural8  reg_rw_uavcan_node_id          ("uavcan.node.id",           Register::Access::ReadWrite, Register::Persistent::No, OPEN_CYPHAL_NODE_ID, [&node_hdl](uint8_t const & val) { node_hdl.setNodeId(val); });
RegisterString    reg_ro_uavcan_node_description ("uavcan.node.description",  Register::Access::ReadWrite, Register::Persistent::No, "OpenCyphal-ToF-Distance-Sensor-Node");
RegisterNatural16 reg_ro_uavcan_pub_distance_id  ("uavcan.pub.distance.id",   Register::Access::ReadWrite, Register::Persistent::No, OPEN_CYPHAL_ID_DISTANCE_DATA, [&pub_distance_id](uint16_t const & val) { pub_distance_id = val; });
RegisterString    reg_ro_uavcan_pub_distance_type("uavcan.pub.distance.type", Register::Access::ReadOnly,  Register::Persistent::No, "uavcan.primitive.scalar.Real32.1.0");
RegisterList      reg_list;

Secondly add those registers to the register list and subscribe to the relevant topics:

reg_list.add(reg_rw_uavcan_node_id);
reg_list.add(reg_ro_uavcan_node_description);
reg_list.add(reg_ro_uavcan_pub_distance_id);
reg_list.add(reg_ro_uavcan_pub_distance_type);
reg_list.subscribe(node_hdl);

Now you can access those registers using i.e. yakut. A short video of a couple of register operations is shown below:

A fully implemented example for the register API can be found here.

Enjoy!

If there are any questions, don’t hesitate to fire off an :email: or ask an question within this forum.

Cheers, Alex

PS: If you are using 107-Arduino-MCP2515 to get your OpenCyphal CAN frames on the wire please updates to 107-Arduino-MCP2515:v1.3.5 as this version contains numerous OpenCyphal/CAN related bug fixes.

3 Likes

Great contribution Alexander! Thanks for keeping us in Arduino.

2 Likes