-
Notifications
You must be signed in to change notification settings - Fork 95
[Bug fix] Navigation scenario: ensure entity placement within constrained environment boundaries #139
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
…environment dimensions
… environment dimensions
matteobettini
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Cool! We should have caught this as part of #133, but I think it is ok since we didn't make a release in the mean time
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove this
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Did I do it correctly?
|
I noticed that in the discovery scenario, the implementation of the x and y bounds differs slightly from what I've done. Here's the relevant link:
How would you suggest proceeding? In the navigation scenario, this pull request introduces two new variables, while in the discovery scenario, the world object is used instead. |
In discovery |
Great! Could you explain why the discovery scenario is boundary-limited, whereas navigation is not? What’s the reasoning behind this? |
|
I am wondering about another thing. If users want to specify the semidims for spawning entities but not have hard bounds, they currently can't. What about:
So that:
|
Just the way they were implemented, which we have to keep as default for bc-compatibility. Now we have the option of bounding navigation too so they are more similar, just with different defaults |
Which scenario are you referring to? I didn't find |
I am proposing to introduce it here |
Oh okay, now I got you. I believe this could be a valuable enhancement. If I understand correctly:
Therefore:
|
Exactly! Let’s also add this comments to the kwargs explaining what they do. Also there is the edge case of only one of the semidims been specified. In the case this happens:
|
|
Hi :) I've been considering the solution, but I've realized that it might lead to navigation behavior that's different from other scenarios. Let me explain:
self.world_spawning_x = kwargs.pop("x_semidim", None)
self.world_spawning_y = kwargs.pop("y_semidim", None)
self.enforce_bounds = kwargs.pop("enforce_bounds", False)I set this to False by default to maintain consistency with previous cases, but I'm open to any suggestions you might have regarding this.
if self.enforce_bounds:
if self.world_spawning_x is None or self.world_spawning_y is None:
raise ValueError("enforce_bounds is active, but one or both semidims are None.")
self.x_semidim = self.world_spawning_x
self.y_semidim = self.world_spawning_y
else:
self.x_semidim = None
self.y_semidim = None
I think this approach is fairly clear because The key idea we need to ensure is: "If the environment is constrained by dimensions, the spawning process must adhere to those limits. For example, if the boundaries are (-0.5, 0.5) for both x and y, the spawning process should respect these limits to ensure that entities remain within reach of one another. In summary, the issue I'm explaining concerns how |
|
Yes, makes sense, but if we do it this way the kwargs should be named these would replace the kwargs we just introduced in the previous pr #133 the error is not needed anymore |
Understood, however my concerns regard the introduction of Also, regarding setting 1 as default, I agree with you, it was my mistake. |
|
I don't think we should consider families of related scenarios. Each scenario has its own kwargs and we don't guarantee any similarity across scenarios. For example, discovery and navigation are different tasks, I don't think we should try to uniform them. The dense reward structure in navigation makes it suitable to unlimited bounds, while discovery needs bounding |
Perfect!! Now it sounds good :) |
|
sorry, I forgot them :/ Now, do I need to do anything else for this pull request? |
vmas/scenarios/navigation.py
Outdated
| if self.enforce_bounds: | ||
| self.x_semidim = self.world_spawning_x | ||
| self.y_semidim = self.world_spawning_y | ||
| else: | ||
| self.x_semidim = None | ||
| self.y_semidim = None |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could we move this after the kwargs reading?
Also maybe a small comment after each of the 3 new kwargs would help
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, it definitely helps. I tried to fix this in my latest commits :)
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #139 +/- ##
==========================================
- Coverage 88.01% 88.00% -0.02%
==========================================
Files 86 86
Lines 9845 9850 +5
==========================================
+ Hits 8665 8668 +3
- Misses 1180 1182 +2 ☔ View full report in Codecov by Sentry. |
|
Thanks a lot, we should be good! |
It resolves Issue #138
Changes Made:
self.world_semidim.self.world_semidim_xandself.world_semidim_y, which default to 1 (as before). If the user opts for a limited-dimension environment, these variables are set to the values ofself.x_semidimandself.y_semidim.Enhancement: