Module prelude

Source

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.
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.
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.
monitoring
Some basic internal monitoring tooling Copper uses to monitor itself and the tasks it is running.
payload
pool
simulation
cu29::simulation Module

Macros§

critical
debug
error
gen_cumsgs
Generates the CopperList content type from a config. gen_cumsgs!(“path/to/config.toml”) It will create a new type called CuMsgs you can pass to the log reader for decoding:
info
input_msg
intern
Interns a string For example:
output_msg
warning

Structs§

AlignedBuffer
A buffer that is aligned to a specific size with the Element of type E.
BincodeAdapter
Bincode Adapter for Freezable tasks This allows the use of the bincode API directly to freeze and thaw tasks.
Cnx
This represents a connection between 2 tasks (nodes) in the configuration graph.
ComponentConfig
This is the configuration of a component (like a task config or a monitoring config):w It is a map of key-value pairs. It is given to the new method of the task implementation.
CopperContext
Just a simple struct to hold the various bits needed to run a Copper application.
CopperLiskMask
Not implemented yet. This mask will be used to for example filter out necessary regions of a copper list between remote systems.
CopperList
CopperListsManager
Manages the lifecycle of the copper lists and logging.
CountingAllocator
A simple allocator that counts the number of bytes allocated and deallocated.
CuArray
Copper friendly wrapper for a fixed size array.
CuArrayVec
A Copper-friendly wrapper around ArrayVec with bincode serialization support.
CuCompactString
CuConfig
CuConfig is the programmatic representation of the configuration graph. It is a directed graph where nodes are tasks and edges are connections between tasks.
CuDuration
For Robot times, the underlying type is a u64 representing nanoseconds. It is always positive to simplify the reasoning on the user side.
CuDurationStatistics
A Specialized statistics object for CuDuration. It will also keep track of the jitter between the values.
CuError
Common copper Error type.
CuExecutionLoop
This structure represents a loop in the execution plan. It is used to represent a sequence of Execution units (loop or steps) that are executed multiple times. if loop_count is None, the loop is infinite.
CuExecutionStep
This structure represents a step in the execution plan.
CuGraph
CuHandle
A shareable handle to an Array coming from a pool (either host or device).
CuHostMemoryPool
A pool of host memory buffers.
CuListsManager
This structure maintains the entire memory needed by Copper for one loop for the inter tasks communication within a process. P or Payload is typically a Tuple of various types of messages that are exchanged between tasks. N is the maximum number of in flight Copper List the runtime can support.
CuLogEntry
This is the basic structure for a log entry in Copper.
CuMsg
CuMsg is the envelope holding the msg payload and the metadata between tasks.
CuMsgMetadata
CuMsgMetadata is a structure that contains metadata common to all CuMsgs.
CuRuntime
This is the main structure that will be injected as a member of the Application struct. CT is the tuple of all the tasks in order of execution. CL is the type of the copper list, representing the input/output messages for all the tasks.
CuSimSinkTask
This is a placeholder task for a sink task for the simulations. It basically does nothing in place of a real driver so it won’t try to initialize any hardware.
CuSimSrcTask
This is a placeholder task for a source task for the simulations. It basically does nothing in place of a real driver so it won’t try to initialize any hardware.
CuTimeRange
Represents a time range.
IncludesConfig
Includes are used to include other configuration files.
Instant
A point-in-time wall-clock measurement.
KeyFrame
A KeyFrame is recording a snapshot of the tasks state before a given copperlist. It is a double encapsulation: this one recording the culistid and another even in bincode in the serialized_tasks.
KeyFramesManager
Manages the frozen tasks state and logging.
LiveStatistics
Accumulative stat object that can give your some real time statistics.
LoggerRuntime
The lifetime of this struct is the lifetime of the logger.
LoggingConfig
MissionsConfig
Missions are used to generate alternative DAGs within the same configuration.
MonitorConfig
NoMonitor
A do nothing monitor if no monitor is provided. This is basically defining the default behavior of Copper in case of error.
Node
A node in the configuration graph. A node represents a Task in the system Graph.
NullLog
OptionCuTime
Homebrewed Option<CuDuration> to avoid using 128bits just to represent an Option.
OwningIoWriter
PartialCuTimeRange
Represents a time range with possible undefined start or end or both.
RobotClock
A running Robot clock. The clock is a monotonic clock that starts at an arbitrary reference time. It is clone resilient, ie a clone will be the same clock, even when mocked.
RobotClockMock
A mock clock that can be controlled by the user.
ScopedAllocCounter
A simple struct that counts the number of bytes allocated and deallocated in a scope.
SectionHandle
A SectionHandle is a handle to a section in the datalogger. It allows to track the lifecycle of a section of the datalogger.
SectionHeader
Each concurrent sublogger is tracked through a section header. They form a linked list of sections. The entry type is used to identify the type of data in the section.
SimpleFileWriter
This allows this crate to be used outside of Copper (ie. decoupling it from the unifiedlog.
UnifiedLoggerBuilder
Use this builder to create a new DataLogger.
UnifiedLoggerIOReader
This a convenience wrapper around the UnifiedLoggerRead to implement the Read trait.
UnifiedLoggerRead
A read side of the datalogger.
UnifiedLoggerWrite
A write side of the datalogger.

Enums§

AllocatedSection
ConfigGraphs
CopperListState
Those are the possible states along the lifetime of a CopperList.
CuExecutionUnit
This structure represents a step in the execution plan.
CuHandleInner
A Handle to a Buffer. For onboard usages, the buffer should be Pooled (ie, coming from a preallocated pool). The Detached version is for offline usages where we don’t really need a pool to deserialize them.
CuLogLevel
Log levels for Copper.
CuTaskCallbackState
This is the state that will be passed to the simulation support to hook into the lifecycle of the tasks.
CuTaskState
The state of a task.
CuTaskType
Copper tasks can be of 3 types:
Decision
Monitor decision to be taken when a task errored out.
SimOverride
This is the answer the simulator can give to control the simulation flow.
Tov
The time of validity of a message can be more than one time but can be a time range of Tovs. For example a sub scan for a lidar, a set of images etc… can have a range of validity.
UnifiedLogType
Defines the types of what can be logged in the unified logger.
UnifiedLogger
Holder of the read or write side of the datalogger.
Value

Constants§

ANONYMOUS
DEFAULT_KEYFRAME_INTERVAL
MAX_LOG_PARAMS_ON_STACK

Statics§

EXTRA_TEXT_LOGGER
GLOBAL

Traits§

ArrayLike
ClockProvider
A trait to provide a clock to the runtime.
CopperListTuple
A CopperListTuple needs to be encodable, decodable and fixed size in memory.
CuApplication
A trait that defines the structure and behavior of a CuApplication.
CuMonitor
Trait to implement a monitoring task.
CuMsgPack
CuMsgPayload
CuPool
A CuPool is a pool of buffers that can be shared between different parts of the code. Handles can be stored locally in the tasks and shared between them.
CuSimApplication
A trait that defines the structure and behavior of a simulation-enabled CuApplication.
CuSinkTask
A Sink Task is a task that only consumes messages. For example drivers for actuators are Sink Tasks.
CuSrcTask
A Src Task is a task that only produces messages. For example drivers for sensors are Src Tasks. They are in push mode from the runtime. To set the frequency of the pulls and align them to any hw, see the runtime configuration. Note: A source has the privilege to have a clock passed to it vs a frozen clock.
CuTask
This is the most generic Task of copper. It is a “transform” task deriving an output from an input.
DeviceCuPool
A device memory pool can copy data from a device to a host memory pool on top.
ElementType
Basic Type that can be used in a buffer in a CuPool.
Freezable
The internal state of a task needs to be serializable so the framework can take a snapshot of the task graph.
PoolMonitor
Trait for a Pool to exposed to be monitored by the monitoring API.
WriteStream
Defines a basic write, append only stream trait to be able to log or send serializable objects.

Functions§

compute_runtime_plan
This is the main heuristics to compute an execution plan at compilation time. TODO(gbin): Make that heuristic pluggable.
default_log_index_dir
Convenience function to returns the default path for the log index directory.
find_task_type_for_id
format_logline
Text log line formatter.
intern_string
log
Function called from generated code to log data. It moves entry by design, it will be absorbed in the queue.
log_debug_mode
This version of log is only compiled in debug mode This allows a normal logging framework to be bridged.
pools_statistics
Get the list of pools and their statistics. We use SmallVec here to avoid heap allocations while the stack is running.
read_configuration
Read a copper configuration from a file.
read_configuration_str
read_interned_strings
Reads all interned strings from the index at the specified path. The index is created at compile time within your project output directory.
rebuild_logline
Rebuild a log line from the interned strings and the CuLogEntry. This basically translates the world of copper logs to text logs.
record_callsite
stream_write
Create a new stream to write to the unifiedlogger.
to_value

Type Aliases§

AscIter
AscIterMut
CuResult
CuTime
A robot time is just a duration from a fixed point in time.
Iter
IterMut
NodeId
NodeId is the unique identifier of a node in the configuration graph for petgraph and the code generation.

Attribute Macros§

copper_runtime
Adds #[copper_runtime(config = “path”, sim_mode = false/true)] to your application struct to generate the runtime. if sim_mode is omitted, it is set to false. This will add a “runtime” field to your struct and implement the “new” and “run” methods.