class ROS2InwardMirrorMixin(ROS2MutationMixin):
Constructor: ROS2InwardMirrorMixin(*args, **kwargs)
Keeps a machinery item's Monitoring variables in sync with the topics it declared.
Creating nodes is the mutation chokepoint's job, which this extends. Writing to them is this mixin's.
| Method | __init__ |
Start out mirroring nothing, and pass every argument to opensmi's constructor. |
| Async Method | bind |
Open one Binding while the server runs, and give it its nodes. |
| Property | ros2 |
Return, per Binding name, whether its topic has a publisher right now. |
| Property | ros2 |
Return, per Binding name, what its subscription asks for and where that came from. |
| Property | ros2 |
Return the subscription each bound Binding on this item opened, in the order they bound. |
| Property | ros2 |
Return the Bindings still waiting for their topic to appear on the graph. |
| Async Method | _bind |
Give one waiting Binding its subscription and its nodes, or report why it has neither. |
| Async Method | _follow |
Write the messages of one Binding until the subscription closes, throttled by max_rate. |
| Async Method | _follow |
Write at most one message per window seconds: the newest, never losing the last. |
| Async Method | _follow |
Bind each waiting Binding as its topic appears, then stop watching. |
| 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 the middleware reports. |
| Async Method | _init |
Open, shape and start every Binding that declared a type, in declaration order. |
| Async Method | _open |
Subscribe, shape the plan, and ask the chokepoint for the nodes of one Binding. |
| Async Method | _report |
Say once, as a BindingEvent, that a bulk payload reached this server's ceiling. |
| Method | _report |
Report, once per Binding, a Projection whose decode names what its shape never created. |
| Method | _require |
Refuse a second Binding of one name on this item. |
| Method | _require |
Return the Runtime this mirror was initialised with. |
| Async Method | _start |
Put the first status on one Binding's variables, then start its tasks. |
| Method | _start |
Open one watch covering every Binding still waiting for its topic, if there are any. |
| Async Method | _stop |
Stop following every Binding, close its subscription, and let go of the graph. |
| Async Method | _write |
Decode one message and write it once, to the nodes of its Binding. |
| Async Method | _write |
Write one message, and survive whatever it could not be written as. |
| Async Method | _write |
Re-write every node of one Binding under the status its publishers now imply. |
| Instance Variable | _deferred |
Undocumented |
| Instance Variable | _graph |
Undocumented |
| Instance Variable | _graph |
Undocumented |
| Instance Variable | _mirrored |
Undocumented |
| Instance Variable | _registry |
Undocumented |
| Instance Variable | _runtime |
Undocumented |
Open one Binding while the server runs, and give it its nodes.
This is the client-driven exception. It lives here and not on the introspection Component, so that an ad-hoc Binding is built exactly like a declared one.
| Parameters | |
binding:MonitoringBinding | What to bind. Its name is what its variables are named for. It lives until the server restarts. |
messagestr | The ROS2 type to subscribe with. It is required, because the caller has just read it off the graph and a run-time Binding has no init at which a declared type could be refused. |
| Returns | |
bool | Whether it happened. False means a mutation cap refused the nodes and the subscription was closed again. |
| Raises | |
DuplicateBindingNameError | When this item already has a Binding of that name. |
ROS2RuntimeError | When the type cannot be resolved or the subscription cannot be opened. |
DeclarationError | When the Binding cannot be shaped (a selection matching nothing, a field with no rendering). |
Return, per Binding name, whether its topic has a publisher right now.
This is Satisfied for a topic read into Monitoring: presence, never first data. It is the count the status code is written from, so a required Binding and its variables agree. A Binding that declared no type and whose topic has not appeared is False, not missing.
Return, per Binding name, what its subscription asks for and where that came from.
A Binding still waiting for its topic is absent, because it has no endpoint yet.
Return the Bindings still waiting for their topic to appear on the graph.
Empty on a Machine whose declarations all name their type, which then never reads the graph.
Write at most one message per window seconds: the newest, never losing the last.
The first message after a quiet spell is written at once. A message arriving inside a window replaces the one waiting, and the waiting one is written when the window ends. The throttle sits in front of the Projection, so a replaced message is never decoded.
Write the status code every time the topic gains or loses its publishers.
The count arrives on the subscription's DDS match events, without reading the graph. The first one arrives at once, so a Binding nobody publishes starts at BadNoCommunication.
Raise one BindingEvent for every QoS incompatibility the middleware reports.
Any adaptation has already happened beneath the handle. The event tells a client that it happened, on which policy, and whether anything will change.
Iterable[ MonitoringBinding], *, runtime: RuntimeInterface, registry: ProjectionRegistry = DEFAULT_REGISTRY):
¶
Open, shape and start every Binding that declared a type, in declaration order.
Anything wrong with such a declaration is fatal at init (a missing interface package, a pattern matching nothing, a field with no rendering, a name written twice), and whatever was already opened is closed first. A Binding that declared no type is put aside, and one watch on the graph facet covers all of them.
MonitoringBinding, *, message_type: str, at_init: bool) -> _Mirrored | None:
¶
Subscribe, shape the plan, and ask the chokepoint for the nodes of one Binding.
| Returns | |
_Mirrored | None | The live Binding, or None when a cap refused its nodes (the subscription is closed again). |
Say once, as a BindingEvent, that a bulk payload reached this server's ceiling.
The test is the length against the ceiling, because the cap is applied in a pure function that cannot report. A buffer as long as the ceiling is a cut one.
Report, once per Binding, a Projection whose decode names what its shape never created.
Unreachable with the shipped Projection. A curated one whose halves disagree is exposed only by a message, so it is reported instead of raised, and the value is not written.
Refuse a second Binding of one name on this item.
| Raises | |
DuplicateBindingNameError | When one is already bound or still waiting for its topic. Without this check the chokepoint would refuse the first colliding variable and name a field path instead of the Binding. |
Return the Runtime this mirror was initialised with.
| Raises | |
DeclarationError | When there is none (a wiring fault). |
Put the first status on one Binding's variables, then start its tasks.
The status is written here and not left to the publisher task, so the variables carry BadNoCommunication from the moment they exist and never the Good that node creation leaves.
Open one watch covering every Binding still waiting for its topic, if there are any.
With none, nothing is opened: the facet reads the graph only while a watch is open.
Stop following every Binding, close its subscription, and let go of the graph.
Idempotent. It runs before the Runtime stops, because a Component torn down on its own still has to stop reading.