WIP Optional ego-size inflation in control_sdc_only obs#475
Open
eugenevinitsky wants to merge 1 commit into
Open
WIP Optional ego-size inflation in control_sdc_only obs#475eugenevinitsky wants to merge 1 commit into
eugenevinitsky wants to merge 1 commit into
Conversation
Add env.ego_size_inflation (float fraction, default 0.0). When > 0 and control_mode == control_sdc_only, the SDC's own perceived length/width in its ego observation are scaled by (1 + ego_size_inflation); set 0.05 for +5%. Observation-only: actual sim_length/sim_width used for dynamics, collision, partner observations and rendering are unchanged. No-op in control_vehicles / control_agents / control_wosac. Plumbed through binding.c, drive.py (kwarg + attribute + C kwargs) and drive.ini (default 0.0, documented). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
There was a problem hiding this comment.
Pull request overview
Adds a new environment knob, env.ego_size_inflation, to optionally scale the SDC’s self-perceived length/width in its own ego observation (intended for control_sdc_only), without changing simulation dynamics/collision geometry.
Changes:
- Plumbs
ego_size_inflationfromDrive(...)(Python) through env init kwargs into the C engine. - Applies the inflation factor in
write_ego_obs()when writing the ego width/length observation features. - Exposes the new key in
pufferlib/config/ocean/drive.ini.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| pufferlib/ocean/drive/drive.py | Adds ego_size_inflation parameter and forwards it into C init kwargs. |
| pufferlib/ocean/drive/drive.h | Stores the new env field and uses it to scale ego width/length observation features. |
| pufferlib/ocean/drive/binding.c | Unpacks ego_size_inflation from Python kwargs into the C env struct. |
| pufferlib/config/ocean/drive.ini | Documents and sets a default value for ego_size_inflation. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+4598
to
+4601
| if (env->ego_size_inflation > 0.0f && env->control_mode == CONTROL_SDC_ONLY) { | ||
| perceived_width *= (1.0f + env->ego_size_inflation); | ||
| perceived_length *= (1.0f + env->ego_size_inflation); | ||
| } |
Comment on lines
+139
to
+141
| # SDC perceives its own size inflated by this fraction in control_sdc_only obs | ||
| # (0 = off, 0.05 = +5%). Observation-only; sim dynamics/collision unchanged. | ||
| ego_size_inflation = 0.0 |
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.
Add env.ego_size_inflation (float fraction, default 0.0). When > 0 and control_mode == control_sdc_only, the SDC's own perceived length/width in its ego observation are scaled by (1 + ego_size_inflation); set 0.05 for +5%. Observation-only: actual sim_length/sim_width used for dynamics, collision, partner observations and rendering are unchanged. No-op in control_vehicles / control_agents / control_wosac.