Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions pufferlib/config/ocean/drive.ini
Original file line number Diff line number Diff line change
Expand Up @@ -111,10 +111,17 @@ map_dir = "pufferlib/resources/drive/binaries/carla"
num_maps = 8

; --- Observation slot counts ---
; Lane slots carry GIGAFLOW W_lane coarse-view samples (40m-spaced points
; along all drivable lanes, top-K nearest within obs_range_coarse_m). Each
; slot reuses the 7-float ROAD_FEATURES layout but reinterprets indices 3-4
; as Dijkstra distance to goal (abs + min-anchored relative).
obs_slots_lane_n = 80
obs_slots_boundary_n = 80
obs_slots_partners_n = 16
obs_slots_traffic_controls_n = 4
coarse_sample_spacing_m = 40.0
obs_range_coarse_m = 200.0
obs_norm_coarse_dist_m = 200.0
Comment on lines +122 to +124
; Fraction of segment observation slots to drop (reduces obs size)
obs_dropout_lane = 0.0
obs_dropout_boundary = 0.0
Expand Down
3 changes: 3 additions & 0 deletions pufferlib/ocean/drive/binding.c
Original file line number Diff line number Diff line change
Expand Up @@ -1957,6 +1957,9 @@ static int my_init(Env *env, PyObject *args, PyObject *kwargs) {
env->obs_slots_lane_n = (int) unpack(kwargs, "obs_slots_lane_n");
env->obs_slots_partners_n = (int) unpack(kwargs, "obs_slots_partners_n");
env->obs_slots_traffic_controls_n = (int) unpack(kwargs, "obs_slots_traffic_controls_n");
env->coarse_sample_spacing_m = (float) unpack(kwargs, "coarse_sample_spacing_m");
env->obs_range_coarse_m = (float) unpack(kwargs, "obs_range_coarse_m");
env->obs_norm_coarse_dist_m = (float) unpack(kwargs, "obs_norm_coarse_dist_m");
env->traffic_control_scope = (int) unpack(kwargs, "traffic_control_scope");
env->dt = (float) unpack(kwargs, "dt");
env->spawn_initial_speed = (float) unpack(kwargs, "spawn_initial_speed");
Expand Down
23 changes: 23 additions & 0 deletions pufferlib/ocean/drive/datatypes.h
Original file line number Diff line number Diff line change
Expand Up @@ -249,6 +249,12 @@ struct Agent {
float goal_position_z; // alias = goal_positions_z[current_goal_idx]
int current_goal_idx; // index of next goal to reach (0..N-1)

// GIGAFLOW W_lane: goal projection (lane in the graph + along-lane arclength).
// Refreshed at every goal-set/advance site so per-step coarse-view emission
// can look up Dijkstra distance from each sample to the current goal in O(1).
int goal_lane_graph_idx; // -1 if no current goal lane found
float goal_along_s;

int stopped; // 0/1 -> freeze if set
int removed; // 0/1 -> remove from sim if set

Expand Down Expand Up @@ -291,6 +297,22 @@ struct RoadMapElement {
int num_exits;
int *exit_lanes;
float speed_limit;

// For drivable lanes only: per-vertex arclength from lane start (length = segment_length).
// NULL for non-drivable elements. Built post-load in build_lane_arclengths.
float *cumulative_s;
};

// Sampled point along a drivable lane centerline; used by the coarse map view
// (GIGAFLOW W_lane). Sampled every coarse_sample_spacing_m meters at map load.
struct CoarseSample {
float x;
float y;
float z;
float heading; // tangent at the sample
int road_idx; // index into Drive.road_elements (which lane this sits on)
int lane_graph_idx; // index into lane_graph (Dijkstra row); == road_to_lane_graph[road_idx]
float along_s; // arclength from lane start to this sample
};

struct TrafficControlElement {
Expand Down Expand Up @@ -339,6 +361,7 @@ void free_road_element(struct RoadMapElement *element) {
free(element->headings);
free(element->entry_lanes);
free(element->exit_lanes);
free(element->cumulative_s);
}

void free_traffic_element(struct TrafficControlElement *element) {
Expand Down
Loading
Loading