ml-agents icon indicating copy to clipboard operation
ml-agents copied to clipboard

Ray perception sensor go through the wall

Open nathan60107 opened this issue 4 years ago • 3 comments

Describe the bug If the sphere cast radius greater than half of the size of an agent, the ray will pass through the wall and make the agent want to go through the wall, because it sees there is nothing.

To Reproduce Steps to reproduce the behavior:

  1. Set an agent and its size is 1x1x1, scale all 1.
  2. Add ray sensor on it, scale all 1.
  3. If the radius greater than 0.5, which is half of the agent size and the distance from the center of agent to wall, than the ray will go through the wall.

Screenshots 圖片 圖片

Environment (please complete the following information):

  • Unity Version: Unity 2019.4.24f1
  • OS + version: Windows 10
  • ML-Agents version: release15
  • Torch version: 1.7.1+cu110

It is because the sphere starts from the center of the agent and goes in its direction to check if there is a collision. So when the sphere is at its start position and the wall is inside the sphere, it will not count as a collision. In my opinion, this problem may be fixed by letting the start position behind the center of the agent.


And I want to give a feature request here. mlagents-learn can add a new option repeat, which have three kinds of parameter:

  1. mlagents-learn --repeat force: Which is the original --force.
  2. mlagents-learn --repeat resume: Which is the original --resume.
  3. mlagents-learn --repeat _(%d): If run-id repeat, it will add a serial number behind run-id automatically. For example, if run-id is apple, and in result directory, we have apple, apple_(1), apple_(2), then new run-id will be apple_(3). User can specify how the serial number name by parameter, the position of %d means where to put the number.

It is confusing that users can use --force and --resume at the same time, and the priority of resume is higher. It should be controlled by one option and can to deal with if user wants to use the same name to train a new model.

nathan60107 avatar Jun 27 '21 08:06 nathan60107

The raycast thing is a known issue, but it's also not a bug. If it wasn't the case, then the rays would never leave the agent!

You're right, the --force and --resume can get a bit confusing. I've noted it down as a feature request. The intended use is not to use --force and just change the run id. Would it meet your needs to have the repeat behavior you specify above as the default behavior when no flags are specified?

ervteng avatar Jun 28 '21 23:06 ervteng

Yes, that is just all users want. An auto-named run-id, and we can use the same name to do the same experiment. Thanks a lot.

Sorry for late reply, I didn't get an e-mail about this issue.

nathan60107 avatar Jul 30 '21 19:07 nathan60107

Just updating for our internal reference (added the request tag so this shouldn't get marked stale).

Internal tracking JIRA: https://jira.unity3d.com/browse/MLA-2092

hvpeteet avatar Nov 08 '21 15:11 hvpeteet