message_manager
Сlass operates with protobuff messages. used to create and parse messages.
Module Contents
Classes
- class message_manager.MessageManager(logger=logging, head_buffer_size=4)[исходный код]
- get_size(self)[исходный код]
- Результат
Value of heder byte buffer.
- Тип результата
int
- static create_requests_message()[исходный код]
Create Empty protobuf class instance for request message.
- Результат
Empty protobuf class instance.
- Тип результата
messages_pb2
- static create_answer_message()[исходный код]
Create Empty protobuf class instance for answer message.
- Результат
Empty protobuf class instance.
- Тип результата
messages_pb2
- static build_request_from_file(path)[исходный код]
Parsing data from message file to protobuf message instance.
- Параметры
path (string) – path to filename.txt with message.
- Результат
protobuf class instance of filled message from file.
- Тип результата
messages_pb2
- build_request_positions(self, positions)[исходный код]
Сreating an instance of the protobuff class and fills it with the values of the actuators
- Параметры
positions (dict) – key - servo name and values - position.
- Результат
protobuf class instance of filled message with servos.
- Тип результата
messages_pb2
- static generate_message(message)[исходный код]
Generate bytes string for sending message.
- Параметры
message (messages_pb2) – protobuf class instance of filled
message. –
- Результат
bytes string of message.
- Тип результата
bytes
- message_from_file(self, path)[исходный код]
Function process the protobuff message. Measurement values of sensors, messages from player.exe and webots. Received messages are placed in the dictionary :param path: path to filename.txt with default message. :type path: [string]
- Результат
protobuf class instance, with values from file.
- Тип результата
messages_pb2
- get_answer_size(self, content_size)[исходный код]
Сalculating message size from header bytes
- Параметры
content_size (bytes) – Byte size of answer message.
- Результат
Size of answer message.
- Тип результата
int
- add_initial_request(self, sensor_name, sensor_time)[исходный код]
Generate bytes string for sending message.
- Параметры
sensor_name (string) – protobuf class instance of filled
message. –
- Результат
bytes string of message.
- Тип результата
bytes
- build_initial_request(self)[исходный код]
Generate bytes string for initialization message.
- Результат
bytes string of message.
- Тип результата
bytes
- parse_answer_message(self, data)[исходный код]
Parsing answer message from byte array to dict with measurements
- Параметры
data ([type]) – [description]
- Результат
[description]
- Тип результата
[type]
- static parse_message(message) dict [исходный код]
Function process the protobuff message. Measurement values of sensors, messages from player.exe and webots. Received messages are placed in the dictionary :param message: protobuf class instance :type message: messages_pb2 :param of new message with filled or unfilled.:
- Результат
dict with keys of names sensors
- Тип результата
dict