Skip to main content

Crate cu29_runtime

Crate cu29_runtime 

Source
Expand description

Copper logo
Copper Runtime & SDK

A Rust runtime for building, running, recording, and deterministically replaying static robot task graphs, from Linux to bare metal.

CI/CD status cu29 on crates.io Rust 1.95 or newer Copper documentation Copper Discord

▶ Try Copper in your browser  ·  Build your first app  ·  Read the book

§Why Copper

Built for robotsBuilt to ship
Static by design: task graphs are declared in RON and wired at compile time.Runs anywhere: Linux, macOS, SBCs, and bare-metal microcontrollers.
Realtime first: zero-allocation, data-oriented execution on the hot path.Deterministic replay: record a run, reproduce it, and inspect it offline.
Rust-first: ergonomic task APIs with compile-time guarantees.Interoperable: connect to ROS 2 through Zenoh and migrate progressively.

Already flying, driving, swimming, spacefaring, and powering humanoids.

§See It Run

These are the same Copper applications used on physical robots, recompiled for the browser. The simulator runs beside a live view of the Copper task graph and latency.

BalanceBot browser demo
BalanceBot
A self-balancing robot simulation using the application that runs on Raspberry Pi hardware.
Source code
Flight controller browser demo
Flight Controller
A quadcopter simulation using the control stack deployed on STM32H7 flight hardware.
Source code

Watch more robots built with Copper in the community showcase, or explore the cross-framework benchmarks.

§Build Your First Copper App

Install the latest stable Rust toolchain, then:

cargo install cargo-cunew
cargo cunew hello_copper
cd hello_copper
cargo run

In about 30 seconds, you have a typed source → task → sink graph that prints its first messages and records logs/hello-copper.copper. Start with copperconfig.ron, src/main.rs, and src/tasks.rs; the generated justfile also provides helpers for logs, CopperLists, topology (just dag), the exact generated process schedule (just plan), post-execution timing from the default Copper log (just plan-log), and replay.

§How Copper Fits Together

flowchart LR
    Config["copperconfig.ron<br/>Static task graph"]
    Generate["#[copper_runtime]<br/>Compile-time generation"]
    Runtime["Deterministic runtime<br/>Zero-alloc hot path"]
    Log["Unified .copper log"]
    Tools["Replay · Export · Inspect"]

    Config --> Generate --> Runtime --> Log --> Tools

The robot is a static thing: Copper turns its declared graph into a purpose-built runtime, then records messages, timing, and state into one replayable log.

§Explore Copper

Learn Book · Runtime overview · API docs
Build Project templates · RON reference · Component catalog
Go deeper Examples · Logging and replay · Python support
Project Supported platforms · Roadmap · Release notes
Community Contributing · GitHub Discussions · Discord

Modules§

app
config
This module defines the configuration of the copper runtime. The configuration is a directed graph where nodes are tasks and edges are connections between tasks. The configuration is serialized in the RON format. The configuration is used to generate the runtime code at compile time.
context
User-facing execution context passed to task and bridge process callbacks.
copperlist
CopperList is the main data structure used by Copper to communicate between tasks. It is a queue that can be used to store preallocated messages between tasks in memory order.
cuasynctask
cubridge
Typed bridge traits and helpers used to connect Copper to external components both as a sink and a source.
curuntime
CuRuntime is the heart of what copper is running on the robot. It is exposed to the user via the copper_runtime macro injecting it as a field in their application struct.
cutask
This module contains all the main definition of the traits you need to implement or interact with to create a Copper task.
cutask_anytime
Trait and types to implement an anytime Copper task.
debug
CuDebug: lightweight time-travel debugger helpers on top of Copper logs.
distributed_replay
Discovery, validation, planning, and causal execution helpers for distributed deterministic replay.
logcodec
monitoring
Some basic internal monitoring tooling Copper uses to monitor itself and the components it runs.
payload
Copper-friendly payload helpers used in task messages and task-local caches.
pool
reflect
Runtime reflection helpers built on top of bevy_reflect.
replay
Shared Clap-backed helpers for replay and resimulation binaries.
resource
Resource descriptors and utilities to hand resources to tasks and bridges. User view: in copperconfig.ron, map the binding names your tasks/bridges expect to the resources exported by your board bundle. Exclusive things (like a serial port) should be bound once; shared things (like a telemetry bus Arc) can be bound to multiple consumers.
simulation
cu29::simulation Module
thread_pool
Construction of configured worker thread pools (std-only).

Macros§

input_msg
output_msg
rx_channels
Declares the receive channels of a CuBridge implementation.
tx_channels
Declares the transmit channels of a CuBridge implementation.