-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathregulator.py
More file actions
37 lines (25 loc) · 759 Bytes
/
Copy pathregulator.py
File metadata and controls
37 lines (25 loc) · 759 Bytes
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
32
33
34
35
36
37
"""
Class for abstract Regulator
"""
import numpy as np
class Regulator(object):
"""docstring for Regulator"""
def __init__(self):
super(Regulator, self).__init__()
def generate_cmd(self):
print 'not implemented'
def setScore(self, score):
print 'not implemented'
class RandomReg(Regulator):
"""Random regulator that generates random commands"""
def __init__(self):
super(RandomReg, self).__init__()
def generate_cmd(self):
cmd = np.radians(np.random.randint(0, 180))
cmd *= np.random.choice([-1, 1])
return cmd
def setScore(self, score):
print 'well, i am a random regulator'
if __name__ == '__main__':
r = RandomReg()
print r.generate_cmd()