Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice

Question How to train an agent that can avoid dynamic randomized obstacles?

Discussion in 'ML-Agents' started by fankepolimi, May 8, 2023.

  1. fankepolimi

    fankepolimi

    Joined:
    May 5, 2023
    Posts:
    2
    In this project, the withe ball aims to reach the green box without collision with these red obstacles. These red obstacles move in this area randomly.

    I tried a lot of times with different reward functions (dense/sparse), and different observations such as grid sensors and ray cast sensors. I can not get good results. Can someone help me with this? I wonder if ppo can not handle this kind of randomized obstacles.
    Thank you very much!!!!!
     

    Attached Files:

  2. fankepolimi

    fankepolimi

    Joined:
    May 5, 2023
    Posts:
    2
    Project overview
     

    Attached Files:

  3. All_American

    All_American

    Joined:
    Oct 14, 2011
    Posts:
    1,528
    What does your training config file look like?
     
  4. tanushka_iv

    tanushka_iv

    Joined:
    Sep 25, 2022
    Posts:
    2
    With dynamic obstacles, you can try using a stack observation of rays,
    for example,
    3-5.
     
  5. MarkMaa

    MarkMaa

    Joined:
    Jan 20, 2020
    Posts:
    32
    I heard that rays must be small (like 1-4 length) for avoiding obstacles
    SetReward(-1) when collided with a red box
    SetReward(0.5f) when reached the green box

    Try it if you haven't yet
     
  6. All_American

    All_American

    Joined:
    Oct 14, 2011
    Posts:
    1,528
    Pretty sure it is “AddReward” not “SetReward”.
     
  7. MarkMaa

    MarkMaa

    Joined:
    Jan 20, 2020
    Posts:
    32
    SetReward
    EndEpisode()