communication_manager_robokit
Class that provides communication with simulator Webots.
Module Contents
Classes
- class communication_manager_robokit.CommunicationManager(maxsize=1, host='127.0.0.1', port=10001, logger=logging, team_color='RED', player_number=1, time_step=15)[исходный код]
- enable_sensors(self, sensors) None [исходный код]
- __get_sensor(self, name) dict [исходный код]
- __send_message(self)[исходный код]
- __update_history(self, message)[исходный код]
- __procces_object(self, name)[исходный код]
- time_sleep(self, t) None [исходный код]
Emulate sleep according to simulation time.
- Параметры
t (float) – time
- get_imu_body(self) dict [исходный код]
Provide last measurement from imu located in body. Can be empty if „imu body“ sensor is not enabled or webots does not sent us any measurement. Also contains simulation time of measurement.
- Результат
{«position»: [roll, pitch, yaw]}
- Тип результата
dict
- get_imu_head(self) dict [исходный код]
Provide last measurement from imu located in head. Can be empty if „imu_head“ sensor is not enabled or webots does not send us any measurement. Also contains simulation time of measurement.
- Результат
{«position»: [roll, pitch, yaw], «time»: time}
- Тип результата
dict
- get_localization(self) dict [исходный код]
Provide blurred position of the robot on the field and confidence in this position („consistency“ - where 1 fully confident and 0 - have no confidence). Can be empty if „gps_body“ sensor is not enabled or webots does not send us any measurement. Also contains simulation time of measurement.
- Результат
{«position»: [x, y, consistency], «time»: time}
- Тип результата
dict
- get_ball(self) dict [исходный код]
Provide blurred position of the ball relative to the robot. Can be empty if: 1. „recognition“, „gps_body“ or „imu_body“ sensors are not enabled 2. webots did not send us any measurement. 3. robot does not stand upright position 4. ball is not in the camera field of view (fov)
Also contains simulation time of measurement.
- Результат
{«position»: [x, y], «time»: time}
- Тип результата
dict
- get_opponents(self) list [исходный код]
Provide blurred positions of the opponents relative to the robot. Can be empty if:
„recognition“, „gps_body“ or „imu_body“ sensors are not enabled
webots did not send us any measurement.
robot does not stand upright position
opponent is not in the camera field of view (fov)
Also contains simulation time of measurement.
- Результат
[{«position»: [x1, y1], «time»: time}, {«position»: [x2, y2], «time»: time}]
- Тип результата
list
- get_mates(self) dict [исходный код]
Provide blurred position of the mate relative to the robot. Can be empty if:
„recognition“, „gps_body“ or „imu_body“ sensors are not enabled
webots did not send us any measurement.
robot does not stand upright position
mate is not in the camera field of view (fov)
Also contains simulation time of measurement.
- Результат
{«position»: [x, y], «time»: time}
- Тип результата
list
- get_time(self) float [исходный код]
Provide latest observed simulation time.
- Результат
simulation time
- Тип результата
float
- send_servos(self, data) None [исходный код]
Add to message queue dict with listed servo names and angles in radians. List of posible servos: [«right_ankle_roll», «right_ankle_pitch», «right_knee», «right_hip_pitch», «right_hip_roll», «right_hip_yaw», «right_elbow_pitch», «right_shoulder_twirl», «right_shoulder_roll», «right_shoulder_pitch», «pelvis_yaw», «left_ankle_roll», «left_ankle_pitch», «left_knee», «left_hip_pitch», «left_hip_roll», «left_hip_yaw», «left_elbow_pitch», «left_shoulder_twirl», «left_shoulder_roll», «left_shoulder_pitch», «head_yaw», «head_pitch»]
- Параметры
data (dict) – {servo_name: servo_angle, …}
- run(self)[исходный код]
Infinity cycle of sending and receiving messages. Should be launched in sepparet thread. Communication manager launch this func itself in constructor