Skip to content

Commit 71ba0f1

Browse files
committed
add robot arm
1 parent f3a8855 commit 71ba0f1

2 files changed

Lines changed: 27 additions & 15 deletions

File tree

Reinforcement_learning_TUT/experiments/arm/DDPG.py

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,21 @@
1+
"""
2+
Environment is a Robot Arm. The arm tries to get to the blue point.
3+
The environment will return a geographic (distance) information for the arm to learn.
4+
5+
The far away from blue point the less reward; touch blue r+=1; stop at blue for a while then get r=+10.
6+
7+
You can train this RL by using LOAD = False, after training, this model will be store in the a local folder.
8+
Using LOAD = True to reload the trained model for playing.
9+
10+
You can customize this script in a way you want.
11+
12+
13+
Requirement:
14+
pyglet >= 1.2.4
15+
numpy >= 1.12.1
16+
tensorflow >= 1.0.1
17+
"""
18+
119
import tensorflow as tf
220
import numpy as np
321
import os
@@ -19,7 +37,7 @@
1937
BATCH_SIZE = 16
2038
VAR_MIN = 0.1
2139
RENDER = True
22-
LOAD = True
40+
LOAD = False
2341
MODE = ['easy', 'hard']
2442
n_model = 1
2543

Reinforcement_learning_TUT/experiments/arm/arm_env.py

Lines changed: 8 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,11 @@
1+
"""
2+
Environment for Robot Arm.
3+
You can customize this script in a way you want.
4+
5+
Requirement:
6+
pyglet >= 1.2.4
7+
numpy >= 1.12.1
8+
"""
19
import numpy as np
210
import pyglet
311

@@ -205,18 +213,4 @@ def on_mouse_leave(self, x, y):
205213
self.mouse_in[0] = False
206214

207215

208-
if __name__ == '__main__':
209-
np.random.seed(2)
210-
env = ArmEnv(False)
211-
212-
env.set_fps()
213-
for ep in range(20):
214-
s = env.reset()
215-
while True:
216-
env.render()
217-
s_, r, done = env.step(np.array([0,0]))
218-
print(r)
219-
if done:
220-
break
221-
# print(s_, r, done)
222216

0 commit comments

Comments
 (0)