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

    deszort

    Joined:
    Jul 17, 2018
    Posts:
    1
    Hi,

    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.
    upload_2022-5-26_19-37-58.png

    The Agent at this scene should send a same value which show in front of the quad.
    e.g.
    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.(-67.xxx~-66.xxx) 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.