class ROS2PublisherSkill(ROS2ContainerMixin, ParentMixin[
Known subclasses: ros2.server.publisher.ROS2ContinuousPublisherSkill, ros2.server.publisher.ROS2FinitePublisherSkill
Constructor: ROS2PublisherSkill(binding, runtime, context, minimum_access_level)
What both publishing Skills share, everything except the tick.
It is not a Skill on its own. The two subclasses below add opensmi's skill logic and differ only in what Running does; the declaration's continuous picks one.
| Method | __init__ |
Resolve everything about the declaration that can be wrong, before any node exists. |
| Async Method | build |
Return the message to publish, given what a client wrote into the Parameters. |
| Async Method | close |
Release this Skill's ROS2 publisher. Idempotent. |
| Async Method | read |
Return what the ParameterSet holds now, by variable name. |
| Class Variable | callable |
Undocumented |
| Property | binding |
Return the declaration this Skill was built from. |
| Property | consecutive |
Return how many publishes in a row have failed, as the tolerance counts them. |
| Property | message |
Return the message dataclass this Skill publishes. |
| Property | publisher |
Return the ROS2 publisher this Skill owns, or None before init and after shutdown. |
| Property | ros2 |
Return what this Skill's publisher offers and where that came from, or None. |
| Async Method | _create |
Create the Parameters that are not message fields. A finite Skill has none. |
| Async Method | _handle |
Clear the failure count. The ParameterSet stays, so nothing a client wrote is lost. |
| Async Method | _init |
Let opensmi build the Skill, create the ParameterSet variables, and prove them. |
| Async Method | _note |
Count one failed publish, report it, and halt when the tolerance is spent. |
| Async Method | _publish |
Publish one snapshot of the Parameters, and let the continuity decide what a failure is. |
| Async Method | _report |
Fire one BindingEvent about this Binding, and never let the reporting be the fault. |
| Instance Variable | _binding |
Undocumented |
| Instance Variable | _context |
Undocumented |
| Instance Variable | _emit |
Undocumented |
| Instance Variable | _failures |
Undocumented |
| Instance Variable | _message |
Undocumented |
| Instance Variable | _parameters |
Undocumented |
| Instance Variable | _plan |
Undocumented |
| Instance Variable | _publisher |
Undocumented |
| Instance Variable | _runtime |
Undocumented |
PublisherBinding, runtime: RuntimeInterface, context: ProjectionContext, minimum_access_level: int = SKILL_ACCESS_LEVEL):
¶
ros2.server.publisher.ROS2ContinuousPublisherSkillResolve everything about the declaration that can be wrong, before any node exists.
| Parameters | |
binding:PublisherBinding | What to build. |
runtime:RuntimeInterface | Where the message is published (the Machine's, reached through the Component). |
context:ProjectionContext | The Projection context this Component renders through, with nothing selected yet. |
minimumint | The level Start, Halt and Reset need. |
| Raises | |
MessageTypeError | When the message type cannot be resolved. |
FieldSelectionError | When a selection pattern matches nothing. |
NotInvertibleError | When the message type reaches a Projection that cannot run backwards, so no client could ever publish through it. |
DeclarationError | When a field of the message would claim the rate Parameter's name on a continuous Skill. |
Return the message to publish, given what a client wrote into the Parameters.
Override this on a custom implementation class when building needs the instance (another
node's value, something injected into the Component). The declaration's message_from is
the pure-function form of the same hook, and default_message_from is the default.
An override must work at init, which calls it once with the declaration's defaults. On a continuous Skill the values include the reserved Rate, which is not a message field.
Release this Skill's ROS2 publisher. Idempotent.
The declaring Component's shutdown calls it, for a Component torn down while the process goes on serving. Stopping the Runtime closes every publisher too.
Return the ROS2 publisher this Skill owns, or None before init and after shutdown.
It is advertised at init and held, so subscribers discover it while a client is still writing the fields and a one-shot push does not race their discovery.
Return what this Skill's publisher offers and where that came from, or None.
None before _init has advertised. The QoS is declared or defaulted, never discovered, so it cannot change.
ros2.server.publisher.ROS2ContinuousPublisherSkillCreate the Parameters that are not message fields. A finite Skill has none.
Let opensmi build the Skill, create the ParameterSet variables, and prove them.
The Parameters a client has not written yet hold the plan's initial values, so building a message from them is the message Start would publish now. A value ROS2 would abort the process over is thus a traceback here, not a core dump on a robot. The publisher is advertised last, so a declaration that cannot boot leaves no endpoint on the graph.
| Raises | |
DeclarationError | When the Component cannot raise a BindingEvent. |
Count one failed publish, report it, and halt when the tolerance is spent.
Every failure is reported, tolerated or not: a tolerated one has no other surface, since the Skill stays Running.
| Raises | |
OpenSmiRuntimeError | When this failure is one too many. |
Publish one snapshot of the Parameters, and let the continuity decide what a failure is.
| Raises | |
OpenSmiRuntimeError | When the publish failed and the tolerance is spent. |