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)[source]
-
- time_sleep(self, t) None [source]
Emulate sleep according to simulation time.
- Parameters
t (float) – time
- get_imu_body(self) dict [source]
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.
- Returns
{“position”: [roll, pitch, yaw]}
- Return type
dict
- get_imu_head(self) dict [source]
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.
- Returns
{“position”: [roll, pitch, yaw], “time”: time}
- Return type
dict
- get_localization(self) dict [source]
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.
- Returns
{“position”: [x, y, consistency], “time”: time}
- Return type
dict
- get_ball(self) dict [source]
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.
- Returns
{“position”: [x, y], “time”: time}
- Return type
dict
- get_opponents(self) list [source]
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.
- Returns
[{“position”: [x1, y1], “time”: time}, {“position”: [x2, y2], “time”: time}]
- Return type
list
- get_mates(self) dict [source]
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.
- Returns
{“position”: [x, y], “time”: time}
- Return type
list
- get_time(self) float [source]
Provide latest observed simulation time.
- Returns
simulation time
- Return type
float
- send_servos(self, data) None [source]
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”]
- Parameters
data (dict) – {servo_name: servo_angle, …}