class documentation

class ROS2EventsMixin(NotificationMixin):

Known subclasses: ros2.server.events.ROS2ModelChangeMixin

Constructor: ROS2EventsMixin(*args, **kwargs)

View In Hierarchy

Gives a machinery item the BindingEvent, on its own Notification node.

Brings opensmi's ~opensmi.server.mixins.NotificationMixin, so a Component that raises BindingEvents has a Notification of its own. The namespace is imported and the generator built in a lifecycle step after the Notification exists and before the item's _init.

Method __init__ Start out with no event generator, and pass every argument to opensmi.
Async Method emit_binding_event Fire one BindingEvent from this machinery item.
Async Method lifecycle_ros2_binding_events Import this project's namespace and build the BindingEvent generator on the Notification.
Method note_binding_event Add one fired BindingEvent to this Machine's ring. Called by every item on it.
Property ros2_namespace_index Return the index this server imported NAMESPACE_URI at.
Property ros2_recent_events Return the BindingEvents the Machine and its Components fired, oldest first, at most RECENT_EVENTS.
Property ros2_root_machine Return the Machine this item reports to, which for a Machine is itself.
Method _house_notification_node Return the node opensmi fires its own machinery-item messages on.
Method _keep Record one fired BindingEvent on this Machine's ring, after the trigger succeeded.
Instance Variable _binding_event_lock Undocumented
Instance Variable _binding_events Undocumented
Instance Variable _recent_binding_events Undocumented
Instance Variable _ros2_namespace_index Undocumented
def __init__(self, *args: Any, **kwargs: Any):

Start out with no event generator, and pass every argument to opensmi.

async def emit_binding_event(self, *, binding: str, path: str, code: str, severity: Severity, text: str | None = None):

Fire one BindingEvent from this machinery item.

Parameters
binding:strThe name of the Binding this is about.
path:strThe ROS2 topic, service, action or node path that Binding names.
code:strWhat happened, as a stable upper-snake-case identifier a client can branch on.
severity:SeverityOne of the house bands.
text:str | NoneA human-readable detail for the event's Message, such as a node's own refusal text. Defaults to a summary of the other three and never carries the code.
Raises
DeclarationErrorWhen this machinery item's BindingEvents were never initialised, so there is no generator to fire from.
@lifecycle(after=NotificationMixin.lifecycle_notification, before=BaseMachineryItem.lifecycle_machinery_item)
async def lifecycle_ros2_binding_events(self) -> AsyncGenerator[None]:

Import this project's namespace and build the BindingEvent generator on the Notification.

opensmi's generator keeps the Binding, ROS2Path and Code fields in the Notification's event history.

def note_binding_event(self, record: BindingEventRecord):

Add one fired BindingEvent to this Machine's ring. Called by every item on it.

@property
ros2_namespace_index: int =

Return the index this server imported NAMESPACE_URI at.

Raises
DeclarationErrorBefore the item's BindingEvents are initialised, which is where the import happens.
@property
ros2_recent_events: tuple[BindingEventRecord, ...] =

Return the BindingEvents the Machine and its Components fired, oldest first, at most RECENT_EVENTS.

@property
ros2_root_machine: Any =

Return the Machine this item reports to, which for a Machine is itself.

def _house_notification_node(self) -> ua.NodeId:

Return the node opensmi fires its own machinery-item messages on.

Raises
DeclarationErrorWhen this machinery item has no Notification at all.
def _keep(self, *, binding: str, path: str, code: str, severity: Severity, text: str):

Record one fired BindingEvent on this Machine's ring, after the trigger succeeded.

_binding_event_lock =

Undocumented

_binding_events: EventGenerator | None =

Undocumented

_recent_binding_events: deque[BindingEventRecord] =

Undocumented

_ros2_namespace_index: int | None =

Undocumented