From e2dc57dd90f65b2f2851455f0acc185d95bbc038 Mon Sep 17 00:00:00 2001
From: Armin <armin.co@hs-bochum.de>
Date: Fri, 12 Mar 2021 22:06:39 +0100
Subject: [PATCH] Added new environment options

---
 carla_environment.py   | 12 ++++++++++--
 environment_wrapper.py |  1 +
 2 files changed, 11 insertions(+), 2 deletions(-)

diff --git a/carla_environment.py b/carla_environment.py
index 6068312..d536520 100644
--- a/carla_environment.py
+++ b/carla_environment.py
@@ -247,15 +247,23 @@ class World:
                     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)
-        rot_diff = ((target.rotation.yaw / 180) - yaw)
 
         v = math.sqrt((vx)**2 + (vy)**2)
         
         r = -0.1
         r += -0.01 * pos_diff
         
-        done = False
+        LEARN_FINAL_ORIENTATION = False
+        if LEARN_FINAL_ORIENTATION:
+            target_yaw = (-175.922913) / 180
+            yaw_dif = math.sqrt((target_yaw**2) - (yaw**2))
+            r += -0.01 * yaw_dif
+
+        INSENTIVE_MOVING = False
+        if v < 0.01 and INSENTIVE_MOVING:
+            r -= 0.02
 
+        done = False
         if pos_diff < 1.5:
             done = True
             r += 100
diff --git a/environment_wrapper.py b/environment_wrapper.py
index c366b1e..61242e3 100644
--- a/environment_wrapper.py
+++ b/environment_wrapper.py
@@ -22,6 +22,7 @@ class Config:
     learn_rate= 0.001
     learn_iterations = 1
     run_episodes = 20
+    offline_batchsize = 2048
     offline_epochs = 1000
     offline_validate_every_x_iteration = 10
     load_ann = False
-- 
GitLab