From c2fed4b4d7a58964a3c5dfbf1b7085e91ae83ee5 Mon Sep 17 00:00:00 2001
From: Armin <armin.co@hs-bochum.de>
Date: Sat, 13 Mar 2021 11:56:40 +0100
Subject: [PATCH] Modified reward function

Car has to stay still at the end.
---
 .gitignore           | 1 +
 carla_environment.py | 8 +++-----
 2 files changed, 4 insertions(+), 5 deletions(-)

diff --git a/.gitignore b/.gitignore
index ef8e367..e624cfb 100644
--- a/.gitignore
+++ b/.gitignore
@@ -4,6 +4,7 @@ saved_agents
 benchmarks
 baselines
 simple
+final_wo_o
 workspace.code-workspace
 test
 tech_demo.py
diff --git a/carla_environment.py b/carla_environment.py
index 8c93ae3..5f00231 100644
--- a/carla_environment.py
+++ b/carla_environment.py
@@ -263,13 +263,11 @@ class World:
             r -= 0.02
 
         done = False
-        if pos_diff < 1.2:
+        if pos_diff < 1.1 and v < 0.01:
             done = True
-            r += 100
+            r += 150
             if yaw_dif < 0.01:
-                r+= 100
-            if v < 0.01:
-                r+=50
+                r+= 50
             
         if self.collision_sensor.collision is not None:
             r -= 100
-- 
GitLab