Skip to content

Add Oignons policy (WIP, do not merge yet(#438

Open
eugenevinitsky wants to merge 1 commit into
emerge/temp_trainingfrom
emerge/temp_training-oignons
Open

Add Oignons policy (WIP, do not merge yet(#438
eugenevinitsky wants to merge 1 commit into
emerge/temp_trainingfrom
emerge/temp_training-oignons

Conversation

@eugenevinitsky
Copy link
Copy Markdown

No description provided.

Copilot AI review requested due to automatic review settings May 23, 2026 01:54
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

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_DIJKSTRA across config parsing, Python bindings, and Drive initialization, with dijkstra using 4 target slots.
  • Extend road observations (ROAD_FEATURES 7 → 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 (remove salade, update oignons).

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 thread pufferlib/viz.py
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)
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.

3 participants