The recipes: curating a ROS2 type is writing data, not code.
A Projection is three pure functions (opensmi.ros2.server.projection). A curation is a plain
data literal from a closed set, so which Projections exist is a list somebody reads:
Default("nav_msgs/msg/Odometry") # walk it; curate nothing Scalar("std_msgs/msg/Float64") # one value, one variable Enum("sensor_msgs/msg/BatteryState", fields={"power_supply_status": {0: "Unknown"}}) Blob("nav_msgs/msg/OccupancyGrid", field="data") # one bulk byte string Drop("nav_msgs/msg/Odometry", fields=("pose/covariance",), override=True)
Functions is the escape hatch for a type that fits none of them. There is no Object recipe:
a message is already a browsable complex Variable, and the mutation chokepoint refuses
the Object verb by name.
Three rules hold for every class. Entries are keyed by type name alone: type_hash= records the
RIHS01 the entry was authored against so CI can report that a type moved, but it never selects an
entry. Registration is explicit, through
~opensmi.ros2.server.projection.ProjectionRegistry.extended, and a second entry for one
type is fatal unless it says override=True. There is no entry-point discovery. Invertibility is
derived from the recipe, never a keyword: the walk always inverts, and the escape hatch
inverts only if given encode=. Default(type_name, override=True) turns curation off for
that type only; a Projection nested inside still applies.
| Class | |
One fixed-width primitive array carried as a single byte string. |
| Class | |
The generic field-walk, as an ordinary entry. |
| Class | |
The generic walk with some fields taken out of it. |
| Class | |
A message walked as usual, with named integer fields rendered as enumerations. |
| Class | |
The escape hatch: a Projection written as the functions themselves. |
| Class | |
A message that carries one value, rendered as that one variable. |
| Constant | GENERIC |
The generic field-walk, as the entry that matches last. |
| Constant | GENERIC |
A registry that curates nothing. opensmi.ros2.server.projections.DEFAULT_REGISTRY extends it. |
| Function | _capped |
Return a bulk payload cut down to the transport's ceiling. |
| Function | _element |
Return the .msg spelling of what a container holds, or "" for anything else. |
| Function | _pack |
Return one array field as the bytes its elements are. |
| Function | _require |
Refuse a named path a type does not have, which is a typo rather than a choice. |
| Function | _scalar |
Return the .msg spelling of a single primitive field, or "" for anything else. |
| Function | _unpack |
Return the elements a byte string holds, in the shape the payload wants them. |
| Function | _written |
Return what a client wrote to one variable of a plan, refusing a payload with a hole. |
| Constant | _INTEGERS |
Which field types can carry an enumeration: one whole number, of any ROS2 width. |
| Constant | _LITTLE |
Byte order, fixed because a client is not necessarily on this host. |
| Constant | _PACKED |
The struct code of each fixed-width ROS2 primitive. |
| Constant | _SIGNED |
Which element types make a packed buffer a SignedByteString rather than a ByteString. |
A registry that curates nothing. opensmi.ros2.server.projections.DEFAULT_REGISTRY extends it.
| Value |
|
Return a bulk payload cut down to the transport's ceiling.
A byte string past the ceiling makes the write fail and the variable stop updating for every
client, so it is cut here instead. A client can compare the length against the capability
variable (opensmi.ros2.server.limits).
Return one array field as the bytes its elements are.
A byte container already crossed as bytes, so packing it is the identity.
Refuse a named path a type does not have, which is a typo rather than a choice.
| Raises | |
UnprojectableFieldError | When a named path is not a path of this type. |
Return the elements a byte string holds, in the shape the payload wants them.
| Raises | |
ValueError | When the byte string is not a whole number of elements. This is a client's write, so it is refused per write and never fatal at init. |
Return what a client wrote to one variable of a plan, refusing a payload with a hole.
| Raises | |
NotInvertibleError | When the name carries no value, as in the walk: a field filled from a default is a value nobody sent. |
Which field types can carry an enumeration: one whole number, of any ROS2 width.
| Value |
|
The struct code of each fixed-width ROS2 primitive.
char and wchar are absent: they cross as Python str and have no packable width.
| Value |
|