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

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!!!!!

8999098--1239685--1215802-8a8cdb669678576e8fc3d60331762469.png

Project overview

8999104--1239697--Screenshot from 2023-05-08 12-58-52.png

What does your training config file look like?

With dynamic obstacles, you can try using a stack observation of rays,
for example,
3-5.

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

Pretty sure it is “AddReward” not “SetReward”.


SetReward
EndEpisode()