class documentation

class Scalar(Projection):

View In Hierarchy

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_type 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_field Return the message's single leaf field.
def decode(self, message: Message, context: ProjectionContext) -> Mapping[str, object]:

Return the one value, under the empty name the shape gave it.

def shape(self, message_type: type[Message], context: ProjectionContext) -> tuple[PlanEntry, ...]:

Return the one variable this message is, named for whatever contains it.

Raises
UnprojectableFieldErrorWhen the message does not carry exactly one value.
datatype: int | None =

What the value is, as a DataType identifier in namespace 0, or None.

variant_type: ua.VariantType | None =

The OPC UA type to carry, where the field's own is not the one wanted.

@property
inverse: EncodeFunction | None =

Return the inverse, which a one-field message always has.

def _encode(self, message_type: type[Message], values: Mapping[str, object], context: ProjectionContext) -> Message:

Put the one value back into the one field.

def _only_field(self, message_type: type[Message]) -> FieldDescription:

Return the message's single leaf field.

Raises
UnprojectableFieldErrorWhen the message has more than one field, or when its one field is another message.