[FEATURE] Environment-wise gravity#1324
Conversation
6947269 to
d506fff
Compare
|
Could you resolve the conflicts? Thanks! |
|
I don't understand why do you have to change the logic this much just for changing the way the gravity is initialised. Moreover, it would be nice to add a setter for the gravity (both pre- and post-build). |
e32580d to
ebcd09e
Compare
91a1a91 to
88fe5fe
Compare
duburcqa
left a comment
There was a problem hiding this comment.
Currently, different solvers may have different gravity. This is kind of hacky and should be removed at some point, but for now that is how it is. This means that what you are doing is not going to work.
However, it is not possible to just update the code block at line 25 to take into account the batch size because it is unknown at this point and will only be specified during build. Anyway, all options should be batch-size agnostic by design. I do not think it is acceptable to have to options that only work for a specific batch size as you are currently doing.
As a result, I would suggest to force option.gravity being a vector, and a base build method to Solver class that would be responsible for both setting the batch size and initialising the gravity field. Then add a setter with the following signature to classSolver:
def set_gravity(self, gravity, envs_idx=None):if envs_idx=None, set the gravity for all environments as you are doing, otherwise set the gravity for one specific environment. Just pass without doing anything if self._gravity = None.
Then, remove all your changes at scene-level for now, and add a set_gravity setter that would call set_gravity for all the underlying solvers sequentially.
663fa80 to
8b0a056
Compare
bbb5c0e to
5342756
Compare
e29c78e to
66011e6
Compare
Head branch was pushed to by a user without write access
|
@LeonLiu4 could you please fix the unit test? Next time you can run them on you local branch first. |
This PR introduces support for environment-specific gravity settings. Different environments in the simulation can now have distinct gravity configurations, enabling more flexible and realistic physics behavior tailored to each context.
Example use case with two spheres:
Addresses: #1113
Below is a video demonstrating two parallel environments one with more negative gravity making the drone fall while the other hovers:
video.mp4