class Enum(Projection):
A message walked as usual, with named integer fields rendered as enumerations.
Naming the values of a ROS2 constant set mints a DataType the client can browse, instead of leaving it a bare number whose meaning lives in a .msg file. The rest of the message is the generic walk, and the number is what goes back on a write, so the recipe inverts.
| Method | decode |
Read the payload as usual: an enumeration's value is the integer that was sent. |
| Method | shape |
Walk the message, with an enumeration variable where a field was named. |
| Instance Variable | fields |
For each ROS2 field name, the label of each value it may carry. The keys are the ROS2 constants themselves, so a set that starts at 1 or skips a number stays correct. |
| Property | inverse |
Return the walk's inverse, which naming values does not take away. |
| Method | _datatype |
Return the DataType's browse name, qualified by the Component. |
| Method | _overrides |
Return the enumeration variable of each named field. |
| Method | _require |
Return True for a field that can carry an enumeration, and refuse one that cannot. |
type[ Message], context: ProjectionContext) -> tuple[ PlanEntry, ...]:
¶
Walk the message, with an enumeration variable where a field was named.
For each ROS2 field name, the label of each value it may carry. The keys are the ROS2 constants themselves, so a set that starts at 1 or skips a number stays correct.
Return the DataType's browse name, qualified by the Component.
DataTypes live in the server-wide address space, while registries are per Component.
type[ Message], context: ProjectionContext) -> Mapping[ str, PlanEntry]:
¶
Return the enumeration variable of each named field.