Skip to content

Update from vcha/stable#435

Merged
vcharraut merged 2 commits into
emerge/temp_trainingfrom
vcha/update
May 21, 2026
Merged

Update from vcha/stable#435
vcharraut merged 2 commits into
emerge/temp_trainingfrom
vcha/update

Conversation

@vcharraut
Copy link
Copy Markdown
Collaborator

No description provided.

Copilot AI review requested due to automatic review settings May 21, 2026 08:55
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 updates the Ocean Drive environment configuration and simulation code to add a new robustness knob (partner_blindness_trigger_prob) and refactors several C helper routines (grid entities, z-updates, stop-line checks, reward coefficient generation) for clearer structure and reduced duplication.

Changes:

  • Add partner_blindness_trigger_prob end-to-end (INI parsing → Python env kwargs → C binding → C simulation), and apply it when masking partner observations.
  • Refactor Drive C implementation (grid-map entity representation, helper extraction for corner computation / z updates / episode summaries, small cleanups).
  • Update example/demo C entrypoints to pass the new configuration field.

Reviewed changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
pufferlib/ocean/env_config.h Adds INI parsing support for partner_blindness_trigger_prob.
pufferlib/ocean/drive/drive.py Adds new Python kwarg, stores it, and passes it to C init kwargs.
pufferlib/ocean/drive/drive.h Adds new Drive field; refactors helpers; applies new trigger probability in observation masking.
pufferlib/ocean/drive/drive.c Wires new config field into demo/perf initialization.
pufferlib/ocean/drive/datatypes.h Adds <stdlib.h> include (supports rand()/RAND_MAX usage).
pufferlib/ocean/drive/binding.c Unpacks partner_blindness_trigger_prob from kwargs into the C env struct.
pufferlib/config/ocean/drive.ini Documents and adds the new INI key.
Comments suppressed due to low confidence (1)

pufferlib/ocean/drive/drive.h:2245

  • collision_check iterates i < env->num_agents but indexes env->active_agent_indices / env->static_agent_indices. In set_active_agents(REPLAY), env->num_agents can exceed active_agent_count+static_agent_count (e.g., INIT_ONLY_CONTROLLABLE_AGENTS when agents are created but not stored in either index array), so this loop can read past static_agent_indices and then index env->agents[-/garbage], causing memory corruption. Consider iterating over (env->active_agent_count + env->static_agent_count) or ensuring env->num_agents is always kept equal to that sum.
    for (int i = 0; i < env->num_agents; i++) {
        int index = -1;
        if (i < env->active_agent_count) {
            index = env->active_agent_indices[i];
        } else {
            index = env->static_agent_indices[i - env->active_agent_count];
        }
        if (index == agent_idx) {
            continue;
        }

        Agent *other_agent = &env->agents[index];


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@@ -1869,9 +1569,6 @@
// Interpolate waypoints along route lanes
for (int route_idx = 0; route_idx < agent->route_length && wp_count < MAX_NUM_WP_PATH; route_idx++) {
int lane_idx = agent->route[route_idx];
Comment on lines 2392 to 2400
for (int j = 0; j < env->num_agents; j++) {
int other_idx;
if (j < env->active_agent_count) {
other_idx = env->active_agent_indices[j];
} else {
other_idx = env->static_agent_indices[j - env->active_agent_count];
}
if (other_idx == -1) {
continue;
}
compute_pairwise_ttc(ego, ego_idx, &env->agents[other_idx], other_idx);
}
Comment on lines 4216 to 4224
AgentDistance candidates[env->num_agents];
int candidate_count = 0;
for (int j = 0; j < env->num_agents; j++) {
int index = -1;
if (j < env->active_agent_count) {
index = env->active_agent_indices[j];
} else if (j < env->num_agents) {
index = env->static_agent_indices[j - env->active_agent_count];
}
lane_segment_dropout=0.0,
boundary_segment_dropout=0.0,
partner_blindness_prob=0.0,
partner_blindness_trigger_prob=0.1,
@vcharraut vcharraut merged commit 34c7341 into emerge/temp_training May 21, 2026
11 checks passed
@vcharraut vcharraut deleted the vcha/update branch May 21, 2026 13:01
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