class ROS2ParameterMirrorMixin(ParameterSetMixin, ROS2EventsMixin):
Constructor: ROS2ParameterMirrorMixin(*args, **kwargs)
Keeps a Component's ParameterSet in sync with the ROS2 nodes it declared.
Mixed in ahead of opensmi's own class. It extends the events mixin, because a node that stops answering is a BindingEvent.
| Method | __init__ |
Start out tuning nothing, and pass every argument to opensmi's constructor. |
| Property | ros2 |
Return, per Binding name, the declared ROS2 parameter names not confirmed present. |
| Async Method | _add |
Create one Parameter, with the access level its declaration asked for and its check. |
| Async Method | _apply |
Take one look at one ROS2 parameter and make the Parameter say what it found. |
| Method | _check |
Refuse what the declaration and the node's descriptor already rule out, without a call. |
| Async Method | _decide |
Decide one write to one Parameter: return to store it, raise to answer it with a code. |
| Async Method | _emit |
Raise one BindingEvent, and never let the reporting itself be the fault. |
| Async Method | _follow |
Mirror every change the node announces, for the names this Binding declared. |
| Async Method | _init |
Create every declared Parameter, then start following the nodes they came from. |
| Async Method | _look |
Read one name and its descriptor off the node and make its Parameter say what came back. |
| Method | _lose |
Note that what the node holds for one name is unknown, so the refresh reads it again. |
| Async Method | _open |
Create one Binding's Parameters and register interest in the node they live on. |
| Async Method | _read |
Read each name that is not confirmed present, one parameter per request. |
| Async Method | _refresh |
Read every unconfirmed name, and keep reading until they are all confirmed. |
| Async Method | _report |
Fire one BindingEvent about one Parameter, at most once per condition per name. |
| Async Method | _report |
Fire one BindingEvent about a whole Binding, at most once per condition. |
| Method | _require |
Return the Runtime this mirror was initialised with. |
| Async Method | _send |
Ask the node to take one value, and answer with what it said. |
| Async Method | _start |
Put the first status on one Binding's Parameters, and start its tasks. |
| Async Method | _stop |
Stop following every ROS2-parameter Binding and close its watch. Idempotent. |
| Async Method | _unreachable |
Say that a node did not answer, and take every one of its Parameters bad with it. |
| Method | _write |
Return the async check opensmi awaits before it stores a value written to one Parameter. |
| Async Method | _write |
Write one Parameter's value and status, as an ordinary write through opensmi. |
| Instance Variable | _parameter |
Undocumented |
| Instance Variable | _tuned |
Undocumented |
Return, per Binding name, the declared ROS2 parameter names not confirmed present.
Empty everywhere means every ROS2-parameter Binding is Satisfied. A name here is a typo in a declaration or a robot that is not answering; the BindingEvent says which.
_Tuned, parameter: str, parameter_type: ParameterType) -> _Parameter:
¶
Create one Parameter, with the access level its declaration asked for and its check.
Read-only is applied here because an access level cannot be moved after _init. A read-only Parameter still gets the write check, which answers a client's write BadNotWritable.
Take one look at one ROS2 parameter and make the Parameter say what it found.
Runs under the Parameter's lock, so a client's write waiting on the node is answered first.
Refuse what the declaration and the node's descriptor already rule out, without a call.
| Raises | |
UaStatusCodeError | BadTypeMismatch, BadNotWritable or BadOutOfRange. |
Decide one write to one Parameter: return to store it, raise to answer it with a code.
The equality test comes first, because it needs no call. It only counts once ROS2 has said something: before that the Parameter holds a typed zero, and a client writing that zero goes to the node like any other write. Inward writes pass as the lock holder's own.
| Raises | |
UaStatusCodeError | With the code the client is answered with. |
ROS2ParameterBinding, code: str, severity: Severity, text: str, parameter: str | None = None):
¶
Raise one BindingEvent, and never let the reporting itself be the fault.
| Parameters | |
binding:ROS2ParameterBinding | Undocumented |
code:str | Undocumented |
severity:Severity | Undocumented |
text:str | Undocumented |
parameter:str | None | The ROS2 parameter this is about, when it is about one rather than the whole node. It is joined onto the event's ROS2Path. |
Mirror every change the node announces, for the names this Binding declared.
Events caused by a client's write are applied like any other, since the node just confirmed the value. Other names are skipped.
Iterable[ ROS2ParameterBinding], *, runtime: RuntimeInterface):
¶
Create every declared Parameter, then start following the nodes they came from.
Fatal on anything wrong with a declaration, such as a name written twice; what was opened is closed again first. No ROS2 call happens here, so the endpoint opens before anything waits for a robot.
Read one name and its descriptor off the node and make its Parameter say what came back.
| Returns | |
bool | Whether the node answered at all. False is about the whole Binding, so a caller working through several names stops. |
ROS2ParameterBinding, runtime: RuntimeInterface) -> _Tuned:
¶
Create one Binding's Parameters and register interest in the node they live on.
| Raises | |
DuplicateVariableNameError | When a name is already taken on this ParameterSet. |
Read each name that is not confirmed present, one parameter per request.
One request per name, since the batch call answers with an empty list when any one name is undeclared, which would blank every value on one typo. A transport failure ends the pass, as the remaining names would time out for the same reason.
Read every unconfirmed name, and keep reading until they are all confirmed.
It is self-disabling: while every name is confirmed it waits on an event and makes no calls. A name going unconfirmed (absent node, timed-out write, deleted parameter) sets the event. Without this, a node that was off at boot and comes up silently would never be seen.
_Tuned, parameter: _Parameter, code: str, severity: Severity, text: str):
¶
Fire one BindingEvent about one Parameter, at most once per condition per name.
The latch is cleared when the name reads well again. The parameter goes in the event's path (the node plus the dotted name), not in the text.
Fire one BindingEvent about a whole Binding, at most once per condition.
The latch lives on the Parameters, because every one of them clears it when it reads well.
Return the Runtime this mirror was initialised with.
| Raises | |
DeclarationError | When there is none, which is a wiring fault. |
Ask the node to take one value, and answer with what it said.
Called with the Parameter's lock held. Returning means the node took the value.
| Raises | |
UaStatusCodeError | BadTypeMismatch or BadOutOfRange when the guard behind the seam refused to put the value in a message; BadOutOfRange or BadInvalidArgument when the node refused it; BadTimeout when the node did not answer in time. |
Put the first status on one Binding's Parameters, and start its tasks.
The status is written here so that a Parameter says BadNoCommunication from the moment it exists, whatever order the tasks run in.
Stop following every ROS2-parameter Binding and close its watch. Idempotent.
It runs before the Runtime is stopped, for a Component torn down while the process goes on serving.
Say that a node did not answer, and take every one of its Parameters bad with it.
Reported once per Binding, since the fact is about the node.