Add Oignons policy (WIP, do not merge yet(#438
Open
eugenevinitsky wants to merge 1 commit into
Open
Conversation
There was a problem hiding this comment.
Pull request overview
This PR introduces a new dijkstra target/goal policy mode for the Ocean Drive environment, extending the simulator, Python bindings, and visualization tooling to support route-aware goal generation and richer road observation features.
Changes:
- Add
TARGET_DIJKSTRAacross config parsing, Python bindings, andDriveinitialization, withdijkstrausing 4 target slots. - Extend road observations (
ROAD_FEATURES7 → 9) to include route-distance-to-goal features and add related lane-graph helpers. - Update visualization (
pufferlib/viz.py) to handle padded rows and new target/dynamics conventions; adjust weights configs (removesalade, updateoignons).
Reviewed changes
Copilot reviewed 9 out of 44 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
| weights/salade/config.yaml | Removes the existing salade weights config. |
| weights/oignons/config.yaml | Tweaks training/env settings; switches target_type to dijkstra. |
| pufferlib/viz.py | Adds dijkstra/dynamics normalization and improved handling of padded observation rows; updates rendering/interactive replay behavior. |
| pufferlib/ocean/env_config.h | Extends INI parsing to accept target_type = dijkstra. |
| pufferlib/ocean/env_binding.h | Exposes TARGET_DIJKSTRA constant to Python. |
| pufferlib/ocean/drive/drive.py | Accepts target_type="dijkstra" and forces 4 waypoints/slots for it. |
| pufferlib/ocean/drive/drive.h | Core implementation: new target type, lane graph indexing, route-aware goals, new road obs features, and map binary loader changes. |
| pufferlib/ocean/drive/datatypes.h | Adds per-goal lane metadata and per-lane precomputed length/cumulative lengths fields; removes lane-graph lane_lengths. |
| pufferlib/ocean/drive/binding.c | Adds debug export of goal/lane/route-distance information and exposes per-lane length/cum-lengths to Python. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
4357
to
4358
| agent->metrics_array[REACHED_GOAL_IDX] = 1.0f; | ||
| agent->current_goal_idx++; |
| float ego_goal_route_distance = INFINITY; | ||
| if (ego_entity->current_goal_idx >= 0 && ego_entity->current_goal_idx < goal_count) { | ||
| goal_lane_idx = ego_entity->goal_lane_ids[ego_entity->current_goal_idx]; | ||
| goal_lane_s = ego_entity->goal_lane_s[ego_entity->current_goal_idx]; |
Comment on lines
+504
to
+512
| static void build_lane_graph_index(Drive *env) { | ||
| free(env->lane_graph_index_by_lane); | ||
| env->lane_graph_index_by_lane = NULL; | ||
| if (env->num_road_elements <= 0 || env->lane_graph.n_lanes <= 0 || env->lane_graph.lane_ids == NULL) { | ||
| return; | ||
| } | ||
| env->lane_graph_index_by_lane = (int *) malloc(env->num_road_elements * sizeof(int)); | ||
| if (env->lane_graph_index_by_lane == NULL) { | ||
| return; |
Comment on lines
+1164
to
+1172
| if (fread(&road->length, sizeof(float), 1, file) != 1) { | ||
| fclose(file); | ||
| return -1; | ||
| } | ||
| road->cum_lengths = (float *) malloc(slen * sizeof(float)); | ||
| if ((size_t) slen > 0 && fread(road->cum_lengths, sizeof(float), slen, file) != (size_t) slen) { | ||
| fclose(file); | ||
| return -1; | ||
| } |
Comment on lines
+1164
to
+1172
| if (fread(&road->length, sizeof(float), 1, file) != 1) { | ||
| fclose(file); | ||
| return -1; | ||
| } | ||
| road->cum_lengths = (float *) malloc(slen * sizeof(float)); | ||
| if ((size_t) slen > 0 && fread(road->cum_lengths, sizeof(float), slen, file) != (size_t) slen) { | ||
| fclose(file); | ||
| return -1; | ||
| } |
Comment on lines
+1018
to
+1020
| dynamics_model = _dynamics_model_name(dynamics_model) | ||
| target_type = _target_type_name(target_type) | ||
| num_target_waypoints = _target_waypoint_count(target_type, num_target_waypoints) |
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.
No description provided.