<unit_name>.unit.yaml.
Top-level fields
A map of argument names to their definitions. Arguments are passed to the unit at launch time via
key=value pairs and are code-generated into typed C++ fields on the unit class.A list of additional C++
#include paths to inject into the generated unit header. Useful when your handler types reference custom message types not automatically included by the serializer.Controls how handlers are allowed to execute relative to each other.
| Value | Behavior |
|---|---|
single | All handlers run mutually exclusive from each other (default). |
A map of handler names to handler definitions. Each handler is a function invoked when its synchronization condition and inputs are satisfied. See Handler definition below.
Handler definition
Each key underhandlers is a user-chosen handler name (e.g. StereoMatch, OnLidarSync). The value is an object with the following fields.
Controls when the handler fires. Omitting
sync means the handler never fires automatically.The
sync value external is also valid. Use it when the handler is triggered externally (i.e., the unit pushes data out on its own, not in response to incoming messages).A map of topic paths to input definitions. All non-optional inputs must be satisfied (according to
sync.type) before the handler fires. See Input definition below.A map of topic paths to output definitions. These are the topics the handler is expected to publish to. See Output definition below.
Input definition
Each key underinputs is a topic path (e.g. /camera_left). The value is an object combining the common transport fields below with input-specific fields.
The message type in The serializer prefix tells Basis which deserialization path to use. Common prefixes are
serializer:MessageType format.rosmsg and protobuf.An alternate type to use when the message is delivered over the in-process (
inproc) transport. Useful when the in-process representation differs from the wire format.The field or method to call on the message to obtain the synchronization key. Used with
equal and approximate sync types.| Pattern | C++ expression produced |
|---|---|
::field | msg->field |
::method_field | msg->method_field() |
complex.access.to_string() | [](T* msg){ return msg->complex.access.to_string(); } |
Accumulate this many messages before passing them to the handler as a batch. Set to a large integer or use
true for infinite accumulation. Useful for event-style inputs that arrive at a higher rate than the sync period.When
true, the last received message is retained between handler invocations and re-used when no new message has arrived.When
true, the handler may fire even if no message has arrived on this topic. The argument in the generated handler function will be a nullable/optional pointer.Whitelist of transport names this input is permitted to receive from. Mutually exclusive with
deny_transports.Blacklist of transport names this input must not receive from. Mutually exclusive with
allow_transports.Quality-of-service settings for this input.
Output definition
Each key underoutputs is a topic path (e.g. /camera_stereo). Output definitions share the transport and QoS fields with inputs, plus one additional field.
The message type in
serializer:MessageType format. Same format as input type.Alternate type for in-process delivery.
When
true, the handler is not required to publish on this topic every invocation. By default all declared outputs are expected on every call; omitting a non-optional output raises a diagnostic error.Whitelist of transports this output may use. Mutually exclusive with
deny_transports.Blacklist of transports this output must not use. Mutually exclusive with
allow_transports.Complete example
The example below covers all handler patterns from the Basis example unit.Handler type summary
equal — exact timestamp sync
equal — exact timestamp sync
All inputs must carry the same
sync_field value. The handler fires once per matching set. Use buffer_size to control how many unmatched messages are held waiting for a partner.approximate — fuzzy timestamp sync
approximate — fuzzy timestamp sync
All inputs must carry
sync_field values within the specified tolerance of each other. The tolerance value is a duration (e.g. 5ms).all — fire when all inputs are ready
all — fire when all inputs are ready
The handler fires as soon as every non-optional input has at least one queued message. Order of arrival does not matter.
rate — timed handler
rate — timed handler
The handler fires on a wall-clock timer. Any declared inputs are passed through when available but do not gate the timer. Specify the frequency in Hz.
external — unit-driven publishing
external — unit-driven publishing
The unit publishes to the declared outputs on its own schedule (e.g. from a driver callback). No incoming messages are required.