From 555f3b12ca4478a919f8e649a2bf947680df42f0 Mon Sep 17 00:00:00 2001 From: Joel Croteau Date: Mon, 25 Jul 2022 19:30:04 -0700 Subject: [PATCH] Remove unused TouchedTarget() methods from examples Crawler, Walker, and Worm all have TouchedTarget methods to add +1 reward that are, as near as I can tell, completely unused. These are not mentioned anywhere in documentation and are potentially very confusing to someone examining the example code. Remove this methods to make the code cleaner and easier to read. --- .../ML-Agents/Examples/Crawler/Scripts/CrawlerAgent.cs | 8 -------- .../ML-Agents/Examples/Walker/Scripts/WalkerAgent.cs | 8 -------- .../Assets/ML-Agents/Examples/Worm/Scripts/WormAgent.cs | 8 -------- 3 files changed, 24 deletions(-) diff --git a/Project/Assets/ML-Agents/Examples/Crawler/Scripts/CrawlerAgent.cs b/Project/Assets/ML-Agents/Examples/Crawler/Scripts/CrawlerAgent.cs index 6165c90ba2..badefe5853 100644 --- a/Project/Assets/ML-Agents/Examples/Crawler/Scripts/CrawlerAgent.cs +++ b/Project/Assets/ML-Agents/Examples/Crawler/Scripts/CrawlerAgent.cs @@ -279,12 +279,4 @@ public float GetMatchingVelocityReward(Vector3 velocityGoal, Vector3 actualVeloc //This reward will approach 1 if it matches perfectly and approach zero as it deviates return Mathf.Pow(1 - Mathf.Pow(velDeltaMagnitude / TargetWalkingSpeed, 2), 2); } - - /// - /// Agent touched the target - /// - public void TouchedTarget() - { - AddReward(1f); - } } diff --git a/Project/Assets/ML-Agents/Examples/Walker/Scripts/WalkerAgent.cs b/Project/Assets/ML-Agents/Examples/Walker/Scripts/WalkerAgent.cs index c0177ec0dd..a3f90400df 100644 --- a/Project/Assets/ML-Agents/Examples/Walker/Scripts/WalkerAgent.cs +++ b/Project/Assets/ML-Agents/Examples/Walker/Scripts/WalkerAgent.cs @@ -285,14 +285,6 @@ public float GetMatchingVelocityReward(Vector3 velocityGoal, Vector3 actualVeloc return Mathf.Pow(1 - Mathf.Pow(velDeltaMagnitude / MTargetWalkingSpeed, 2), 2); } - /// - /// Agent touched the target - /// - public void TouchedTarget() - { - AddReward(1f); - } - public void SetTorsoMass() { m_JdController.bodyPartsDict[chest].rb.mass = m_ResetParams.GetWithDefault("chest_mass", 8); diff --git a/Project/Assets/ML-Agents/Examples/Worm/Scripts/WormAgent.cs b/Project/Assets/ML-Agents/Examples/Worm/Scripts/WormAgent.cs index 6a5c2044bc..29f3066099 100644 --- a/Project/Assets/ML-Agents/Examples/Worm/Scripts/WormAgent.cs +++ b/Project/Assets/ML-Agents/Examples/Worm/Scripts/WormAgent.cs @@ -125,14 +125,6 @@ public override void CollectObservations(VectorSensor sensor) } } - /// - /// Agent touched the target - /// - public void TouchedTarget() - { - AddReward(1f); - } - public override void OnActionReceived(ActionBuffers actionBuffers) { // The dictionary with all the body parts in it are in the jdController