OpenSMI object paths and the rules for building them from OPC UA browse names.
Shared by everything that builds OpenSMI paths (server, client browsing, NodeSet loader, code generation), so the same address space always yields the same paths.
| Class | |
Path of an OpenSMI object, e.g. /M1/Components/Gripper/SkillSet/Pick. |
| Function | check |
Check name against the OpenSMI naming rule for browse names. |
| Function | check |
Check that segment can be a path segment: a non-empty str without /. |
| Function | node |
Sort key independent of the server's namespace indexes: namespace URI, OPC UA identifier type, identifier. |
| Function | sanitize |
Return the path segment for browse_name: / replaced by _, an empty name becomes _. |
| Function | to |
Convert a snake_case name to PascalCase: split on _, capitalize each part, join. |
| Function | unique |
Return a sanitized, unique path segment for each sibling, given as (node id, browse name). |
| Function | _split |
Undocumented |
| Constant | _ANY |
Undocumented |
| Constant | _GLOB |
Undocumented |
| Constant | _LOGGER |
Undocumented |
| Constant | _NAME |
Undocumented |
| Constant | _REPLACEMENT |
Undocumented |
| Constant | _RESERVED |
Undocumented |
| Constant | _SEPARATOR |
Undocumented |
Check name against the OpenSMI naming rule for browse names.
Browse names of machines, components, resources, skills, checks, methods and variables match ^[A-Z][A-Za-z0-9]*$ and aren't True, False or None, so they are valid identifiers in common languages. Not enforced yet: opensmi-server warns and rejects from 1.0 on.
Two kinds of names are exempt and only need to pass check_segment(): usernames, and instances named from runtime data rather than the model (e.g. one object per diagnostic id or TF frame), which code generation never sees. DataType browse names are outside the rule. Foreign names such as ROS2's snake_case convert with to_pascal_case().
| Raises | |
ValueError | If name breaks the rule. |
Check that segment can be a path segment: a non-empty str without /.
The hard rule for every name (browse names and usernames); the stricter naming rule is check_name().
| Raises | |
TypeError | If segment is no str. |
ValueError | If segment is empty or contains /. |
Sort key independent of the server's namespace indexes: namespace URI, OPC UA identifier type, identifier.
Convert a snake_case name to PascalCase: split on _, capitalize each part, join.
Only the first letter of a part changes, the rest stays as is: child_frame_id → ChildFrameId, max_vel_x → MaxVelX, pose2d → Pose2d. Empty parts (__, leading or trailing _) vanish. The result is not checked, so pass it to check_name(): none becomes the reserved None, 2d_pose becomes 2dPose, and two names may convert to the same one (x_1 and x1).
Iterable[ tuple[ NodeIdDefinition, str]]) -> dict[ NodeIdDefinition, str]:
¶
Return a sanitized, unique path segment for each sibling, given as (node id, browse name).
Siblings are processed in NodeId order (namespace URI, then identifier), so the result doesn't depend on browse order or namespace indexes. A segment already used gets the first free suffix _2, _3, ...; a suffixed segment never takes the unchanged segment of another sibling. Sanitized and suffixed segments are logged as warnings.