ros2-cyphal-bridge

ROS 2 <-> Cyphal bridge with YAML-configured routing and transforms.
Install
pip install ros2-cyphal-bridge
Requirements
- ROS 2 installed and sourced (for
rclpy). - Python >= 3.9.
- Cyphal DSDL types available via
CYPHAL_PATH(e.g., the public regulated data types). - libpcap (needed for UDP transport on Linux, and included in the Docker image).
Usage
ros2-cyphal-bridge --config bridge.yaml
Config format
Example example_bridge.yaml:
version: 1
cyphal:
node_id: 99
node_name: "com.manufacturer.project.example_ros2_bridge"
can_iface: "socketcan:slcan0"
can_mtu: 8
cyphal_to_ros2:
- rule: "uavcan.node.Heartbeat.1.0@42 -> /nodes/uptime:std_msgs/msg/UInt32"
transform: "data=int(msg.uptime)"
- rule: "2000:uavcan.si.unit.pressure.Scalar.1.0 -> /robot/sensors/pressure:sensor_msgs/msg/FluidPressure"
transform: "fluid_pressure=float(msg.pascal);variance=0.0"
- rule: "2003:uavcan.si.unit.temperature.Scalar.1.0 -> /robot/sensors/temperature:sensor_msgs/msg/Temperature"
transform: "temperature=float(msg.kelvin - 273.15);variance=0.0"
- rule: "2001:uavcan.primitive.scalar.Bit.1.0 -> /robot/sensors/limit_switch:std_msgs/msg/Bool"
transform: "data=bool(msg.value)"
ros2_to_cyphal:
- rule: "/setpoint:std_msgs/msg/Float32 -> 2002:uavcan.primitive.scalar.Real32.1.0"
transform: "value=float(msg.data)"
Cyphal config
node_id: Optional Cyphal node-ID; if omitted, usesUAVCAN__NODE__IDor leaves it unset.node_name: Optional node name foruavcan.node.GetInfo; defaults tocom.manufacturer.project.ros2_bridge.can_iface: Optional PyCyphal CAN interface (e.g.,socketcan:slcan0).can_mtu: Optional CAN MTU (e.g.,8).udp_iface: Optional UDP interface (e.g.,127.0.0.1).
Rule syntax
- Cyphal endpoint:
port_id@node_id:dsdl_typeport_idcan be omitted to use the fixed port ID (e.g.,uavcan.node.Heartbeat.1.0).@node_idis optional.
- ROS 2 endpoint:
/topic:pkg/msg/Type. - Rules use
left -> rightfor direction.
Transform syntax
Transforms are assignment expressions separated by ;:
field=value
The left-hand side is a target field on the output message. The right-hand side is a Python expression evaluated with:
msg(input message)float,int,bool,abs,min,max,math
Examples:
data=float(msg.pascal)value=float(msg.data)
Security note: transforms use Python eval and must be treated as trusted input only.
Quick start (Docker)
Run the bridge container with the example config:
docker run --rm --net=host -v $(pwd)/tools/docker/example_bridge.yaml:/tmp/bridge.yaml:ro ponomarevda/ros2-cyphal-bridge:v0.3.0 --verbose
Notes
- Requires a ROS 2 environment (
rclpy) for execution. - Cyphal DSDL types are resolved via
CYPHAL_PATH. - Cyphal
uavcan.node.GetInforeportssoftware_versionfrom the package version (setuptools-scm tag).
Troubleshooting
- UDP/libpcap: On Linux, PyCyphal UDP capture relies on libpcap and raw packet access. Install libpcap (e.g.,
libpcap/libpcap-dev) and grant raw capture privileges (run as root or givecap_net_rawto the Python interpreter), per PyCyphal’s UDP transport docs. - NumPy scalar conversion error: If you see
TypeError: only 0-dimensional arrays can be converted to Python scalars(e.g., inyakut monitor) after a NumPy upgrade, try pinning NumPy to 2.3.5.
Metadata
Release files for ros2-cyphal-bridge 0.3.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| ros2_cyphal_bridge-0.3.0.tar.gz | 19.6 kB | Without provenance | Details for ros2_cyphal_bridge-0.3.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| ros2_cyphal_bridge-0.3.0-py3-none-any.whl | Python 3 | none | any | Details for ros2_cyphal_bridge-0.3.0-py3-none-any.whl |
Total release size: 29.8 kB
Release files / ros2_cyphal_bridge-0.3.0.tar.gz
| Download URL | ros2_cyphal_bridge-0.3.0.tar.gz |
|---|---|
| Size | 19.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
41b82407005384b2997b2772dab6526e817a95222b53d0b2f4896ea4bab95a6f
|
|
BLAKE2b-256 checksum How to use checksums |
b251f80b38ece12676578be697721bda884ee5965c147a46b43c0736bf0ea2fa
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.11.14
|
Release files / ros2_cyphal_bridge-0.3.0-py3-none-any.whl
| Download URL | ros2_cyphal_bridge-0.3.0-py3-none-any.whl |
|---|---|
| Size | 10.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
126aaeaa286049777ea5195235d297ff7d0815c9a3b3320b8dad4c072ebd05c2
|
|
BLAKE2b-256 checksum How to use checksums |
79f6d8b29a9b7e9bfb0401e162670d9405f174860dd167becee07653a7c8ec37
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.11.14
|
Security for ros2-cyphal-bridge 0.3.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.