#cyphal #uavcan #uav #codec #can #data-transfer

no-std canadensis_encoding

A Cyphal implementation: Transfer encoding and decoding

6 releases

0.3.1 Sep 5, 2023
0.3.0 Mar 30, 2023
0.2.2 Oct 18, 2022
0.2.1 Apr 12, 2022
0.1.0 Jul 11, 2021

#1919 in Embedded development

41 downloads per month
Used in 4 crates (2 directly)

MIT/Apache

75KB
2K SLoC

Canadensis: A Cyphal implementation

This project implements (most of) Cyphal (previously called UAVCAN v1.0). As the Cyphal website explains, "Cyphal is an open technology for real-time intravehicular distributed computing and communication based on modern networking standards (Ethernet, CAN FD, etc.). It was created to address the challenge of on-board deterministic computing and data distribution in next-generation intelligent vehicles: manned and unmanned aircraft, spacecraft, robots, and cars."

This is currently an independent project, not affiliated with the Cyphal Consortium.

Submodule note

This repository uses a submodule for the public regulated data types. When cloning, use git clone --recursive. If you have already cloned the repository without the recursive option, run git submodule init followed by git submodule update. Otherwise, some tests will fail.

Published crates

Crate Description
canadensis (documentation) The main library with all core transport-independent functionality
canadensis_data_types (documentation) Rust types corresponding to the Cyphal public regulated data types
canadensis_can (documentation) Cyphal/CAN transport
canadensis_bxcan (documentation) Compatibility for bxCAN embedded CAN controllers
canadensis_linux (documentation) Compatibility for Linux SocketCAN interfaces
canadensis_serial (documentation) Experimental Cyphal/Serial transport
canadensis_udp (documentation) Experimental Cyphal/UDP transport
canadensis_pnp_client (documentation) A client library for plug-and-play node ID allocation
canadensis_crc (documentation) Access to the software image CRC
canadensis_write_crc (documentation) A tool to calculate and write the CRC of a software image for use with canadensis_crc
canadensis_codegen_rust (documentation) A DSDL processor that generates Rust data types and serialization code
canadensis_macro (documentation) A procedural macro that generates Rust data types and serialization code from inline and/or external DSDL files

Other crates (canadensis_bit_length_set, canadensis_core, canadensis_derive_register_block, canadensis_dsdl_frontend, canadensis_dsdl_parser, canadensis_encoding, and canadensis_filter_config) are re-exported in various places, so you normally will not need to depend on them directly.

Status

This code is intended to conform to version 1.0-beta of the Cyphal specification.

Most of the functionality works. Some parts are incomplete:

  • There are some tests, but there are probably several bugs in areas that have not been tested.
  • The amount of dynamic memory allocation can be reduced, or at least documented better.
  • It needs better documentation

Principles

  • Runs on embedded devices
  • Uses dynamic memory allocation, but only when necessary
  • Supports Cyphal/CAN (classic CAN and CAN FD)
  • Supports Cyphal/Serial and Cyphal/UDP (these transports are not fully specified yet, but the canadensis implementations were compatible with pycyphal when they were released)

License

Licensed under either of

at your option.

Contribution

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.


lib.rs:

Cyphal data type serialization and deserialization

Dependencies

~1.4–2MB
~33K SLoC