add static obstacle support to the aviary#99
Open
evanofficial wants to merge 1 commit into
Open
Conversation
Adds an Obstacle abstraction and an Aviary.add_obstacle() helper for spawning static URDF objects (built-in cube/cylinder/sphere primitives, or arbitrary URDF paths) that drones can collide with. Obstacles are remembered by the aviary and respawned across reset().
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Re #60. Scoped to static obstacles for this round — the issue mentions lidar/depth as a natural follow-up but those felt like a much bigger conversation about the action/observation space, so this PR keeps things minimal and additive. Happy to take a swing at sensors in a follow-up once this lands and the API shape feels right.
What this adds
PyFlyt.core.abstractions.Obstacle— thin wrapper aroundloadURDFwithuseFixedBase=True, takes a position/orientation/scale and exposes the PyBullet bodyId.Aviary.add_obstacle(urdf, position, orientation=None, scale=1.0)— registers the obstacle with the aviary, callsregister_all_new_bodies()so collisions get tracked, and remembers the spec so it gets respawned onreset().PyFlyt/models/obstacles/:cube,cylinder,sphere. Loadable by name; arbitrary URDF paths also work.Usage
Collisions show up in
env.contact_arraythe same way drone-drone collisions do.Tests
tests/test_obstacles.pycovers:Aviary.reset()contact_arrayObstacle.builtin_obstacles()listingAll 11 obstacle tests pass locally on Python 3.12 / PyBullet 3.2.7. The existing
tests/test_gym_envs.pysuite (136 tests) still passes — no regressions.Docs
Added
docs_source/documentation/core/abstractions/obstacle.mdand hooked it into the abstractions toctree, matching the existing pattern (autoclass+ a usage example).Follow-ups (not in this PR)
Open to any naming / API tweaks before this gets cleaned up.