Skip to main content

ROS2 to Cyphal bridge (YAML-configured)

Project description

ros2-cyphal-bridge PyPI ci-and-deploy

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).

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, uses UAVCAN__NODE__ID or leaves it unset.
  • node_name: Optional node name for uavcan.node.GetInfo; defaults to com.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_type
    • port_id can be omitted to use the fixed port ID (e.g., uavcan.node.Heartbeat.1.0).
    • @node_id is optional.
  • ROS 2 endpoint: /topic:pkg/msg/Type.
  • Rules use left -> right for 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 \
  ros2-cyphal-bridge:v0.2.0 --verbose

Notes

  • Requires a ROS 2 environment (rclpy) for execution.
  • Cyphal DSDL types are resolved via CYPHAL_PATH.
  • Cyphal uavcan.node.GetInfo reports software_version from the package version (setuptools-scm tag).

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

ros2_cyphal_bridge-0.2.0.tar.gz (18.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

ros2_cyphal_bridge-0.2.0-py3-none-any.whl (9.2 kB view details)

Uploaded Python 3

File details

Details for the file ros2_cyphal_bridge-0.2.0.tar.gz.

File metadata

  • Download URL: ros2_cyphal_bridge-0.2.0.tar.gz
  • Upload date:
  • Size: 18.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.14

File hashes

Hashes for ros2_cyphal_bridge-0.2.0.tar.gz
Algorithm Hash digest
SHA256 c4e6621048290a87c26b48a0b9b72decd3c0750828a72abf8e6a354df7d2d81c
MD5 762bad67ae296ca9dbd3ef6205f57dc5
BLAKE2b-256 dcab37036bd87bce6cfc43b57a9c49382425e8e2b00d329af63b43778b1da5dc

See more details on using hashes here.

File details

Details for the file ros2_cyphal_bridge-0.2.0-py3-none-any.whl.

File metadata

File hashes

Hashes for ros2_cyphal_bridge-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 0e0d4c962e24d253577962ef5475113b5a61b3eafeeb62be06e38264fcbf0719
MD5 f00c40428a4cb4b80d8aaa72e20e3c3c
BLAKE2b-256 84d4827fd8019de21bdc2fc9754c2de92fcef8cfeb0996f278989f45cc72cbaf

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page