-
Notifications
You must be signed in to change notification settings - Fork 12
/
main.py
29 lines (24 loc) · 799 Bytes
/
main.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
#!/usr/bin/python
import vrep
import rl_helper
rl_functions = None
try:
vrep.simxFinish(-1)
clientID = vrep.simxStart('127.0.0.1', 19999, True, True, 5000, 5)
if clientID != -1:
rl_functions = rl_helper.RL(clientID)
print('Main Script Started')
rl_functions.init_sensors()
rl_functions.start_sim()
while vrep.simxGetConnectionId(clientID) != -1:
rl_functions.rotor_data = [5.4, 5.4, 5.4, 5.4]
rl_functions.do_action()
rl_functions.target_z = 5.0
print(rl_functions.get_reward())
else:
print "Failed to connect to remote API Server"
rl_functions.stop_sim()
vrep.simxFinish(clientID)
except KeyboardInterrupt:
rl_functions.stop_sim()
vrep.simxFinish(clientID)