class ROS2TransformMirrorMixin(_OutwardPublishing):
Constructor: ROS2TransformMirrorMixin(*args, **kwargs)
Keeps every SpatialObject on one Machine in step with the TF tree, on a timer.
Machine only: a frame belongs to the nearest declared head above it, and the heads are spread
over the Machine and its Components. The period is declared on the Machine for the same reason
(~opensmi.ros2.server.config.TransformConfig.interval). How many Locations one TF
Binding may gain is ~opensmi.ros2.server.mutation.ROS2MutationMixin.mutation_node_cap on
the declaring item; a robot with more frames says so once.
| Method | __init__ |
Start out with nothing rendered, and pass every argument to opensmi. |
| Async Method | lifecycle |
Start the poll once the whole Machine is built, and stop it before teardown. |
| Async Method | refresh |
Read the frame network once and bring every SpatialObject into step with it. |
| Property | ros2 |
Return the frame-to-node index: every rendered frame and the node holding it, as NodeId text. |
| Property | ros2 |
Return how often the frame network has been read, which a Machine with no TF leaves at 0. |
| Method | _declared |
Return this Machine's SpatialObject and every Component's, in browse order. |
| Async Method | _init |
Collect every SpatialObject on this Machine and start the poll, if there are any. |
| Async Method | _poll |
Read the frame network on the interval and render it, until cancelled. |
| Async Method | _pose |
Browse the nine value-bearing nodes of one Location, once, on its first bad write. |
| Async Method | _report |
Say, as a BindingEvent, that more than one coordinate system is being presented as one. |
| Method | _require |
Refuse a Machine on which two declarations claim one frame. |
| Async Method | _stop |
Stop the poll. Idempotent, and it leaves the watches to the items that opened them. |
| Async Method | _write |
Compose and write every alternative this object declared, creating new ones. |
| Async Method | _write |
Write one bad reading onto the Location, its pose and its six scalars. |
| Async Method | _write |
Write every Location of one object: its pose, and the Base its TF parent implies. |
| Async Method | _write |
Write one Location from the transform its TF parent published, and say how it is. |
| Async Method | _write |
Write one Location's pose, status and Base, and only what changed. |
| Async Method | _write |
Put one pose on a Location's nine value-bearing nodes, with its status. |
| Instance Variable | _transform |
Undocumented |
| Instance Variable | _transform |
Undocumented |
| Instance Variable | _transform |
Undocumented |
| Instance Variable | _transform |
Undocumented |
| Instance Variable | _transform |
Undocumented |
| Instance Variable | _transform |
Undocumented |
| Instance Variable | _transform |
Undocumented |
| Instance Variable | _transform |
Undocumented |
AsyncGenerator[ None]:
¶
Start the poll once the whole Machine is built, and stop it before teardown.
It starts after the Machine's _init because the Components' objects must exist first, and stops before _shutdown so no tick writes into a Component that is going away.
Read the frame network once and bring every SpatialObject into step with it.
Public so that tests can drive the inward path without waiting for the timer.
Collect every SpatialObject on this Machine and start the poll, if there are any.
Nothing is created for frames the robot publishes and nothing is asked of it: the first tick is one interval away. Declared outward frames are created here, so a client may write them before the robot is on. The cross-object direction check runs first.
| Raises | |
FrameDirectionError | When two declarations on this Machine claim one frame. |
Browse the nine value-bearing nodes of one Location, once, on its first bad write.
The result is safe to keep because nodes are never moved.
Say, as a BindingEvent, that more than one coordinate system is being presented as one.
Once per distinct set of roots, and there is no clearing event. Nothing is said while no robot is publishing: before that, a Machine that publishes two frames under different bases has two roots by construction. Reported on the Machine's own TF Binding.
Refuse a Machine on which two declarations claim one frame.
This is the cross-object half of the inward/outward rule, which no single declaration can see. It runs before anything is created.
| Raises | |
FrameDirectionError | When one frame is claimed twice. |
_Owner, *, frames: Mapping[ str, FrameLink], quiet: _Quiet):
¶
Compose and write every alternative this object declared, creating new ones.
This is the only place the transform buffer is asked anything. The lookup is synchronous, and a chain it cannot complete is skipped. An alternative carries the status of the frame it views, so two nodes never disagree about a quiet frame.
_Frame, position: Position, orientation: Orientation, status: ua.StatusCode):
¶
Write one bad reading onto the Location, its pose and its six scalars.
The scalars too, because clients subscribe to Position/X. Not the Base, which stays true while the frame is unreachable. The Location is written first; opensmi's child sync ignores a null value, so the children keep what is written to them next.
_Owner, *, frames: Mapping[ str, FrameLink], parents: Mapping[ str, str], quiet: _Quiet):
¶
Write every Location of one object: its pose, and the Base its TF parent implies.
This runs after all new Locations exist, so a Base never points at the World Frame for one tick and at a Location the next.
_Frame, link: FrameLink | None, *, base: ua.NodeId, status: ua.StatusCode):
¶
Write one Location from the transform its TF parent published, and say how it is.
A frame nothing has published yet still gets its Base and status.
_Frame, pose: tuple[ tuple[ float, float, float], tuple[ float, float, float, float]] | None, *, base: ua.NodeId, status: ua.StatusCode):
¶
Write one Location's pose, status and Base, and only what changed.
Writing an unchanged value still wakes every MonitoredItem on the node. The status counts as a change: a bad status nulls its value (OPC UA Part 4 7.7.1), so a frame that returns at the pose it left must still be written. Used for both a frame's Location and an alternative's, which differ only in where the pose came from.
_Frame, position: Position, orientation: Orientation, status: ua.StatusCode):
¶
Put one pose on a Location's nine value-bearing nodes, with its status.
A Good pose goes through opensmi's write_pose. opensmi cannot write a status code, so a
bad status is written by hand, always with the value, because a status alone leaves the
variant null (see ~opensmi.ros2.server.status).