A service is a Method: a client writes the request, calls, and reads what came back.
| ParameterSet | The request's fields, writable in any state. They are the Method's arguments, because opensmi's Call takes none of its own. |
| Call | Read the Parameters, build the request, send it, write the response. |
| FinalResultData | The response's fields, written when the call returns. |
A Method has no Monitoring, because a service has no feedback.
opensmi's Call checks the access level (the Skill level, skill_access_level, default
~opensmi.ros2.server.access.SKILL_ACCESS_LEVEL, because a service call commands the robot),
the Lock and a completed startup, then runs ROS2ServiceMethod.execute_method. A
UaStatusCodeError raised there becomes the returned status code; anything else becomes
BadInternalError.
Two kinds of failure are told apart. A transport failure means the call did not happen: no server on the path gives BadNotConnected, a server that took the request and went quiet gives BadTimeout. This is the one place where the UA layer translates an error itself, because a missing service server reported as an internal error would blame the wrong party. An application failure (the service ran and refused) answers Good with the response in FinalResultData. A declaration may name the verdict field (success_field); a False in it answers BadRequestNotAllowed with the response still written. No field is detected automatically, since ROS2 has no standard success field; a wrong name fails at init.
FinalResultData and the Parameters are never reset, so FinalResultData holds the last response that arrived; the status code is the verdict on the latest call. Post-call work goes into an override of execute_method that calls super() first.
default_request_from and default_response_to are pure functions of a message and
its Projection context. A declaration may name its own pair; a replacement that needs the
instance overrides ROS2ServiceMethod.build_request or
ROS2ServiceMethod.read_response. The containers are built in
opensmi.ros2.server.containers.
| Class | |
The Method one ~opensmi.ros2.server.bindings.MethodBinding becomes. |
| Function | default |
Build a request message out of what a client wrote into a Method's Parameters. |
| Function | default |
Read a response message into the FinalResultData variables its type was shaped into. |
| Constant | TRANSPORT |
The two ways a call does not happen, and the UA status code each becomes. |
| Function | _require |
Refuse a success_field the response has no bool field for. |
| Function | _transport |
Return the UA status code one transport failure becomes. |
| Constant | _TRANSPORT |
What ROS2ServiceMethod._call_the_service catches, derived from the table. |
type[ Message], values: Mapping[ str, object], context: ProjectionContext) -> Message:
¶
Build a request message out of what a client wrote into a Method's Parameters.
The Projection covering the request type, run backwards. A pure function: no server, rclpy or event loop.
| Raises | |
NotInvertibleError | When a field of the request has no value, because the selection removed it or no Parameter carries it. Such a field is refused instead of filled with a default. |
The two ways a call does not happen, and the UA status code each becomes.
They differ for an operator: nothing serves the path, or something serves it and is stuck.
| Value |
|
Refuse a success_field the response has no bool field for.
| Raises | |
SuccessFieldError | When the field is absent, or is present and is not a bool. |
Return the UA status code one transport failure becomes.
The fallback is unreachable today. It keeps an error class added later without a table entry on opensmi's own answer instead of a StopIteration inside an exception handler.
What ROS2ServiceMethod._call_the_service catches, derived from the table.
| Value |
|