class documentation
class Scalar(Projection):
A message that carries one value, rendered as that one variable.
std_msgs/msg/Float64 on /battery_voltage browses as battery_voltage instead of battery_voltage_data. The message must have exactly one leaf field, and anything else is refused at init: a second field would have to be filled from a default on the way back, which is refused.
| Method | decode |
Return the one value, under the empty name the shape gave it. |
| Method | shape |
Return the one variable this message is, named for whatever contains it. |
| Instance Variable | datatype |
What the value is, as a DataType identifier in namespace 0, or None. |
| Instance Variable | variant |
The OPC UA type to carry, where the field's own is not the one wanted. |
| Property | inverse |
Return the inverse, which a one-field message always has. |
| Method | _encode |
Put the one value back into the one field. |
| Method | _only |
Return the message's single leaf field. |
def shape(self, message_type:
type[ Message], context: ProjectionContext) -> tuple[ PlanEntry, ...]:
¶
Return the one variable this message is, named for whatever contains it.
| Raises | |
UnprojectableFieldError | When the message does not carry exactly one value. |
def _encode(self, message_type:
type[ Message], values: Mapping[ str, object], context: ProjectionContext) -> Message:
¶
Put the one value back into the one field.