forked from herohuyongtao/deeptag-pytorch
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcontroller_set.py
31 lines (21 loc) · 925 Bytes
/
controller_set.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
from manual_controller import ManualController
MANUAL_CONTROL = True
# These represent incremental movements of the thumbnail that guides the robots.
# MAX_FORWARD_SHIFT is in units of pixels of the output image.
# MAX_ANGULAR_SHIFT is in radians.
MAX_FORWARD_SHIFT = -10
MAX_ANGULAR_SHIFT = -0.1
class ControllerSet:
def __init__(self):
if MANUAL_CONTROL:
self.manual_controller = ManualController()
def get_movements(self, decoded_tags):
movement_dict = {}
for tag in decoded_tags:
if not tag['is_valid']:
continue
assert 'tag_id' in tag
# TBD: Filter other tags corresponding to anything but active robots.
#movement_dict[tag['tag_id']] = MAX_FORWARD_SHIFT, MAX_ANGULAR_SHIFT
movement_dict[tag['tag_id']] = self.manual_controller.get_forward_angular_tuple()
return movement_dict