4 releases
0.4.0 | Mar 31, 2023 |
---|---|
0.2.2 | Oct 18, 2022 |
0.2.1 | Apr 12, 2022 |
0.2.0 | Oct 31, 2021 |
#5 in #canadensis
41 downloads per month
Used in canadensis
150KB
3K
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
- Apache License, Version 2.0 (LICENSE-APACHE or http://www.apache.org/licenses/LICENSE-2.0)
- MIT license (LICENSE-MIT or http://opensource.org/licenses/MIT)
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/UDP transport
The current version of the transport is documented in a forum post from 2022-12-02.
If the std
feature is enabled, this implementation requires the std
library for sockets.
How sockets work
Sending
A transport can use one socket to send all outgoing message and service transfers. This socket binds to and an ephemeral UDP port on one network interface.
Outgoing transfers get sent to a multicast address based on the port ID and a fixed UDP port.
Receiving transfers
All transfers are received through one socket, which joins any multicast groups required to receive the correct frames.
Dependencies
~3.5MB
~68K SLoC