class Blob(Projection):
One fixed-width primitive array carried as a single byte string.
A million-cell grid as one UA array is a million Variants on the wire, and as one ByteString it is one buffer copy. The rest of the message is the generic walk. The element type comes from the ROS2 definition, so int8[], uint8[] and float32[] need no keyword. Signedness is published as a DataType, because a -1 would otherwise reach a plain ByteString as 0xFF.
The recipe never transforms the bytes. Naming a datatype says what they are (a CompressedImage's data really is a JPEG), and then the round trip can no longer be claimed for the author, so the Blob inverts only if an encode is supplied.
| Method | decode |
Read the payload as usual, with the named field packed into bytes and capped. |
| Method | shape |
Walk the message, with the named field rendered as one byte string. |
| Instance Variable | datatype |
What the bytes are, as a DataType identifier in namespace 0 (ua.ObjectIds.ImagePNG), or None to publish the signedness derived from the element type. |
| Instance Variable | encode |
A codec whose round trip the author claims. Supplying it is that claim. |
| Instance Variable | field |
The ROS2 field to carry as bytes. |
| Property | inverse |
Return the supplied codec, else byte identity; None when a datatype is named without a codec. |
| Method | _datatype |
Return what the variable's bytes say they are. |
| Method | _encode |
Unpack the byte string back into the elements the field holds. |
| Method | _packed |
Return the named field, having checked that it is a fixed-width primitive array. |
type[ Message], context: ProjectionContext) -> tuple[ PlanEntry, ...]:
¶
Walk the message, with the named field rendered as one byte string.
What the bytes are, as a DataType identifier in namespace 0 (ua.ObjectIds.ImagePNG), or None to publish the signedness derived from the element type.
type[ Message], values: Mapping[ str, object], context: ProjectionContext) -> Message:
¶
Unpack the byte string back into the elements the field holds.