Skip to content
Snippets Groups Projects
Commit 640f456f authored by Armin Co's avatar Armin Co
Browse files

Fixed yaw_dif

Positive reward for stoping at final position.
Positive reward for correct orientation at final position.
parent e2dc57dd
Branches
No related tags found
No related merge requests found
...@@ -246,27 +246,30 @@ class World: ...@@ -246,27 +246,30 @@ class World:
carla.Location(x=-25.534311, y=54.460903, z=0.112781), \ carla.Location(x=-25.534311, y=54.460903, z=0.112781), \
carla.Rotation(pitch=0.000000, yaw=-175.922913, roll=-6.221135)) carla.Rotation(pitch=0.000000, yaw=-175.922913, roll=-6.221135))
pos_diff = math.sqrt((target.location.x - x)**2 + (target.location.y - y)**2)
v = math.sqrt((vx)**2 + (vy)**2) v = math.sqrt((vx)**2 + (vy)**2)
pos_diff = math.sqrt((target.location.x - x)**2 + (target.location.y - y)**2)
target_yaw = (-175.922913) / 180
yaw_dif = math.sqrt((target_yaw - yaw)**2)
r = -0.1 r = -0.1
r += -0.01 * pos_diff r += -0.01 * pos_diff
LEARN_FINAL_ORIENTATION = False LEARN_FINAL_ORIENTATION = True
if LEARN_FINAL_ORIENTATION: if LEARN_FINAL_ORIENTATION:
target_yaw = (-175.922913) / 180
yaw_dif = math.sqrt((target_yaw**2) - (yaw**2))
r += -0.01 * yaw_dif r += -0.01 * yaw_dif
INSENTIVE_MOVING = False INSENTIVE_MOVING = True
if v < 0.01 and INSENTIVE_MOVING: if v < 0.01 and INSENTIVE_MOVING:
r -= 0.02 r -= 0.02
done = False done = False
if pos_diff < 1.5: if pos_diff < 1.2:
done = True done = True
r += 100 r += 100
if yaw_dif < 0.01:
r+= 100
if v < 0.01:
r+=50
if self.collision_sensor.collision is not None: if self.collision_sensor.collision is not None:
r -= 100 r -= 100
......
...@@ -19,25 +19,61 @@ c.load_from = 'Carla_2_256__128__128_0.9995_0.001_1DBL' ...@@ -19,25 +19,61 @@ c.load_from = 'Carla_2_256__128__128_0.9995_0.001_1DBL'
c.load_mem = True c.load_mem = True
c.load_ann = True c.load_ann = True
# o = copy.deepcopy(c)
# o.name = 'JTAP_4'
# o.force_cpu = True
# o.render = True
# o.learn = True
# o.env_type = 'Carla'
# o.net_layout = [256, 128, 128]
# o.save_to = 'simple/'
# o.load_from = 'Carla_JTAP_0_256__128__32_0.9995_0.001_1DBL'
# o.load_mem = True
# o.load_ann = False
# o.learn_offline = True
# o.offline_epochs = 75000
# o.offline_batchsize = 256
# o.learn_iterations = 1
# o.offline_validate_every_x_iteration = -1
# o.learn_online = False
# o.eps_decay = 0.9995
# o.learn_rate= 0.001
# o.run_episodes = 15
o = copy.deepcopy(c) o = copy.deepcopy(c)
o.name = 'JTAP_5' o.name = 'JTAP_0'
o.force_cpu = True
o.render = True o.render = True
o.learn = True o.learn = True
o.env_type = 'Carla' o.env_type = 'Carla'
o.net_layout = [128, 32, 32] o.net_layout = [256, 128]
o.save_to = 'test/' o.save_to = 'orientation/'
o.load_from = 'Carla_JTAP_4_128__32__32_0.9999_0.0005_1' o.load_from = ''
o.load_mem = True o.load_mem = False
o.load_ann = False o.load_ann = False
o.learn_offline = True
o.offline_epochs = 1500
o.learn_iterations = 1
o.offline_validate_every_x_iteration = -1
o.learn_online = True o.learn_online = True
o.eps_decay = 0.9999 o.eps_decay = 0.9995
o.learn_rate= 0.0005 o.learn_rate= 0.001
o.run_episodes = 500 o.run_episodes = 750
validate = copy.deepcopy(c)
validate.name = 'JTAP_Validate'
validate.render = True
validate.learn = True
validate.env_type = 'Carla'
validate.net_layout = [256, 128]
validate.save_to = 'simple/'
validate.load_from = 'Carla_JTAP_0_256__128__32_0.9995_0.001_1DBL'
validate.load_mem = False
validate.load_ann = True
validate.learn_offline = False
validate.offline_epochs = 1500
validate.learn_iterations = 1
validate.offline_validate_every_x_iteration = -1
validate.learn_online = True
validate.eps_decay = 0.9995
validate.learn_rate= 0.001
validate.run_episodes = 10
# t = copy.deepcopy(c) # t = copy.deepcopy(c)
# t.render = True # t.render = True
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment