Fix random track generation for config level 3#112
Merged
Conversation
ratheron
approved these changes
Jun 30, 2026
deniz-onat
added a commit
to deniz-onat/lsy_drone_racing
that referenced
this pull request
Jul 6, 2026
…b#91, learnsyslab#112) Pull the exact upstream/main versions of the sim env's track randomization: - learnsyslab#112: rewrite random track generation for level 3 (collision-free layouts). - learnsyslab#91: report the randomized layout as the nominal gate/obstacle positions in the observation, instead of the (meaningless-under-randomization) config poses. Includes the matching unit tests. Controllers and dependencies untouched. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
aloisi101-bit
pushed a commit
to aloisi101-bit/lsy_drone_racing
that referenced
this pull request
Jul 7, 2026
* Fix random track generation * Remove gate corridors
aloisi101-bit
pushed a commit
to aloisi101-bit/lsy_drone_racing
that referenced
this pull request
Jul 7, 2026
* Fix random track generation * Remove gate corridors
aloisi101-bit
pushed a commit
to aloisi101-bit/lsy_drone_racing
that referenced
this pull request
Jul 7, 2026
* Fix random track generation * Remove gate corridors
aloisi101-bit
pushed a commit
to aloisi101-bit/lsy_drone_racing
that referenced
this pull request
Jul 7, 2026
* Fix random track generation * Remove gate corridors
aloisi101-bit
pushed a commit
to aloisi101-bit/lsy_drone_racing
that referenced
this pull request
Jul 7, 2026
* Fix random track generation * Remove gate corridors
aloisi101-bit
pushed a commit
to aloisi101-bit/lsy_drone_racing
that referenced
this pull request
Jul 7, 2026
* Fix random track generation * Remove gate corridors
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.
Overview
This PR fixes the track generation to no longer sample configurations where gates and obstacles would sometimes get sampled nearly on the same spot.
Redesigned sampling
Previously, if we found no good solution within the constraints of the track generator, we used position created uniformly at random. This PR turns the track generation into a three stage process, where we first sample around preferred positions, fall back to any viable position, and finally fall back to the positions that least violate our design constraints.
Algorithm
First, we initialize grids for the obstacles and gates (
gate_clear,obs_clear) that track the clearance to the closest objects. We then iteratively sample gate and obstacle positions and update the clearance maps.Gates are placed at random with a minimum distance to all objects. If there is no space left, we use the maximum clearance we can find. Previously, we fell back to uniform sampling, which lead to the collisions we saw.
Obstacles are also placed at random, but preferably between the previous and the next gate. If that is not possible, they are placed randomly in a valid position. Finally, if that is not possible, we again fall back to the maximum clearance.
We now also allow the track to randomize the drone position. To enable this setting, we have to increase the drone position randomization in the level 3 configs. This is on hold for now to not interrupt the running course.
Breaking changes
One change this PR introduces in the track generation is that we no longer attempt to stay clear of previous gate corridors. This reduces complexity and allows for a larger variety of tracks.
Related Issues
Fixes #110, fixes #107