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

93 add test for resetting the poses in vectorized env #94

Merged
merged 10 commits into from
Dec 26, 2023

Conversation

luigiberducci
Copy link
Collaborator

Add tests for vectorized environments, closes #93

@luigiberducci luigiberducci changed the base branch from main to v1.0.0 October 18, 2023 08:09
@luigiberducci luigiberducci self-assigned this Nov 24, 2023
other tests and f110 env: change default map from Vegas to Spielberg because new reset needs centerline.
observation: add +0.5 to max scan range to avoid rays slightly above max range.
@luigiberducci
Copy link
Collaborator Author

Implemented automatic reset methods. Add test to auto-reset in vec environments.
Closes #93 and #95.

The reset methods use the centerline waypoints to sample starting poses.
For this reason, I had to replace the default track "Vegas" with "Spielberg" because the centerline was not defined.

@hzheng40 please review

Copy link
Member

@hzheng40 hzheng40 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, just had some questions.


x, y = wp[0], wp[1]
if n_agents > 1:
lat_offset = rnd_sign * (-1.0) ** i * (1.0 / n_agents)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i'm not sure if it's i-th power or i(1/n)-th power?

) # first wp id with dist > mind, len of the interval btw first/last wp
pnt_id = current_wp_id # moving pointer to scan the next waypoints
dist = 0.0
while dist <= max_dist:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i think this whole while loop is only needed if you don't have the arclengths in the track.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it's not exactly the same but even if there's a speedup it won't be that different

# others
import numpy as np

# gl
import pyglet
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

might need to pull in changes from the rendering pr

@hzheng40 hzheng40 merged commit a428945 into v1.0.0 Dec 26, 2023
4 checks passed
@luigiberducci luigiberducci deleted the 93-reset-vector-env branch February 14, 2024 11:29
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

Successfully merging this pull request may close these issues.

Reset doesn't work with VectorEnv api: https://gymnasium.farama.org/api/vector/
2 participants