Search Unity

  1. We are migrating the Unity Forums to Unity Discussions. On July 12, the Unity Forums will become read-only. On July 15, Unity Discussions will become read-only until July 18, when the new design and the migrated forum contents will go live. Read our full announcement for more information and let us know if you have any questions.

Get observations value by RayPerceptionSensor3D

Discussion in 'ML-Agents' started by deszort, May 26, 2022.

  1. deszort


    Jul 17, 2018

    I'm trying to get a value use RayPerceptionSensor3D. And for testing it, I use a simple scene.

    This scene contain an Agent( blue cube )and a quad which show a value in front of it easy to observe. Just like a picture below.

    The Agent at this scene should send a same value which show in front of the quad.
    The show number is "2" and the Agent's discreteAction should choice "2". (the number range from 0 to 5)

    In my first test, at "OnEpisodeBegin()" block I set the show value direictly so this test the ray is unnecessary. And the training result is success.

    But at the second test, the value initilize to "-1" and set after ray detect, the training result from first to last didn't have obviously change.( The Reward are -100 and +100 at the failed and success situation. And regardless failed or successed will into "EndEpisode()".

    The third test, at failed situation, I change the rewardfrom -100 to -10 and take away this code "EndEpisode()", after that I got a success training model.

    Could someone tell me why the third test successed.