Skip to content

serialize.to_proto

Full path: schola.core.protocols.protobuf.serialize.to_proto

schola.core.protocols.protobuf.serialize.to_proto

to_proto

to_proto(msg)

Serialize Python objects to protobuf messages.

This is a generic function that uses singledispatch to handle different Python object types. It converts Python/Gymnasium objects like actions and spaces into protobuf messages that can be sent to Unreal Engine.

Parameters

msg (Any) : The Python object to serialize. This can be a Note: For action serialization, you must also pass the corresponding space as the first argument.

Returns

The serialized protobuf message.

Return type: Any

Raises

  • ValueError - If the message type is not supported or if required parameters are missing.

Notes

This function has multiple registered implementations for different Python object types. See the individual @to_proto.register implementations for specific type conversions. To serialize gymnasium spaces use space_to_proto.