Skip to content
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

Running multiple threaded envs in parallel #271

Open
yj-Tang opened this issue Aug 14, 2024 · 2 comments
Open

Running multiple threaded envs in parallel #271

yj-Tang opened this issue Aug 14, 2024 · 2 comments

Comments

@yj-Tang
Copy link

yj-Tang commented Aug 14, 2024

Hi Max, I’m currently trying to run multiple urdfenvs in parallel, as suggested here. While everything runs smoothly overall, I'm encountering an issue with goal generation in the parallel environments, except for the first one.

In both the regular environments and the first parallel environment, the key for the goal is '1'. However, in the other parallel environments, the key unexpectedly changes to '0', and the goal position defaults to [0,0,0]. Could you clarify what the key represents in this context? Do you have any insights into what might be causing this issue?

Thank you for your time.
Best regards,
Yujie

@maxspahn
Copy link
Owner

Hi @yj-Tang,

it is a very interesting use case for this repository, and I haven't played around with parallelization at all myself, so I am curious about this. And i am very eager to help here.

The indices of goals and obstacles have no meaning at all, so are simply the index provided by pybullet at creation of the instances. I hoped they would be unique, which does not seem to be true. For now, I have no quick fix.

Can you also provide me with a small example here?

Best, Max.

@yj-Tang
Copy link
Author

yj-Tang commented Aug 19, 2024

Hi Max,

I've forked this repo to my GitHub repository. My changes are in the "vectorized_envs" branch. Here's a summary of the modifications:

  1. Flattened the observation of burden and created a CustomizedFlattenObservation wrapper.
  2. Implemented a vectorized environment using the flattened observation, allowing multiple environments to run independently.
  3. Modified gym_envs_urdf/urdfenvs/urdf_common/urdf_env.py to support running multiple PyBullet environments in parallel.
  4. Added a simple script gym_envs_urdf/examples/test_parallel_env.py to test the vectorized environment.

The vectorized environment appears to be running, but I've noticed an issue: the goal information (first 3 elements in the observation) seems incorrect.

I would greatly appreciate if you could give any comment on the goal information discrepancy.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants