class ROS2KeyedMirrorMixin(ROS2MutationMixin):
Constructor: ROS2KeyedMirrorMixin(*args, **kwargs)
Keeps a machinery item's Keyed Bindings' members in sync with what arrives on their topics.
Mixed in ahead of opensmi's class. The mutation chokepoint it extends creates the nodes; this mixin decides which nodes there should be. It runs loops parallel to the inward mirror's (stream, publisher count, QoS) on purpose, since sharing them would need a callback at every step.
| Method | __init__ |
Start out with no Keyed Bindings, and pass every argument to opensmi. |
| Property | ros2 |
Return, per Keyed Binding name, whether its topic has a publisher right now. |
| Property | ros2 |
Return, per Keyed Binding name, what its subscription asks for and where it came from. |
| Property | ros2 |
Return, per Keyed Binding name, the browse name of each member it has created. |
| Async Method | _create |
Create the aggregate variable in the Binding's group, beside the members, at init. |
| Async Method | _create |
Add every key this message names for the first time, in one mutation. |
| Async Method | _follow |
Write every message of one Keyed Binding, until the subscription closes. |
| Async Method | _follow |
Write the status code every time the topic gains or loses its publishers. |
| Async Method | _follow |
Raise one BindingEvent for every QoS incompatibility reported on this Binding's topic. |
| Async Method | _init |
Open, shape and start every Keyed Binding, in declaration order. |
| Async Method | _open |
Subscribe, shape the member plan, and create one Keyed Binding's aggregate. |
| Async Method | _report |
Say, as a BindingEvent, that a key has no member because its name is already taken. |
| Async Method | _report |
Fire the BindingEvent for a member's state change. |
| Method | _report |
Log once per Binding a decoded name its shape never created. |
| Method | _require |
Return the Runtime this mirror was initialised with. |
| Async Method | _start |
Put the first status on what a Keyed Binding already has, then start its tasks. |
| Async Method | _stop |
Stop following every Keyed Binding and close its subscription. |
| Async Method | _write |
Write the highest state any member holds, when this Binding has such a variable. |
| Async Method | _write |
Give every element of one message its member, creating the ones that are new. |
| Async Method | _write |
Re-write everything this Binding owns under the status its publishers now imply. |
| Async Method | _write |
Decode one element onto its member's variables and return the state transition, if any. |
| Instance Variable | _keyed |
Undocumented |
| Instance Variable | _keyed |
Undocumented |
| Instance Variable | _keyed |
Undocumented |
Return, per Keyed Binding name, whether its topic has a publisher right now.
Presence works as for a topic read into Monitoring and does not depend on membership: a Binding with a publisher but no member yet is a robot with nothing to report.
Return, per Keyed Binding name, what its subscription asks for and where it came from.
The counterpart of
~opensmi.ros2.server.mirror.ROS2InwardMirrorMixin.ros2_qos_provenance.
Return, per Keyed Binding name, the browse name of each member it has created.
In creation order. Members are append-only, so this only grows.
Add every key this message names for the first time, in one mutation.
One chokepoint call gives one model-change event for the whole batch. A key that cannot have a member (its browse name is taken by another key or by something else on this Monitoring, or a cap closed the Binding) is reported once and remembered as refused, so a 10 Hz topic raises one event and not one per message.
Raise one BindingEvent for every QoS incompatibility reported on this Binding's topic.
Like the inward mirror's _follow_qos, with the same code.
Iterable[ KeyedBinding], *, runtime: RuntimeInterface, registry: ProjectionRegistry = DEFAULT_REGISTRY):
¶
Open, shape and start every Keyed Binding, in declaration order.
Fatal at init on a bad declaration: a field that does not repeat a message, a key field that is not a scalar leaf, a state field the Projection never renders, an element type that is not installed. What a message carries is never fatal. Only the aggregate is created here; members appear with messages.
_Keyed, key: tuple[ str, ...], claimed: tuple[ str, ...], browse: str):
¶
Say, as a BindingEvent, that a key has no member because its name is already taken.
| Parameters | |
keyed:_Keyed | Undocumented |
key:tuple[ | Undocumented |
claimed:tuple[ | The key that holds the name, where one does. Empty when the name belongs to something that is not a member -- this Binding's own aggregate, say. |
browse:str | Undocumented |
_Keyed, member: _Member, previous: object, current: object):
¶
Fire the BindingEvent for a member's state change.
Log once per Binding a decoded name its shape never created.
Unreachable with the shipped Projections; a curated one whose halves disagree only shows up with a message.
Return the Runtime this mirror was initialised with.
| Raises | |
DeclarationError | When there is none, which is a wiring fault and never a ROS2 condition. |
Stop following every Keyed Binding and close its subscription.
Idempotent. Runs before the Runtime is stopped, so a Component torn down on its own still stops reading.
Re-write everything this Binding owns under the status its publishers now imply.
The value goes with it: a status written alone leaves the variant null.