Skip to content

Change observation layout: goal normalization and road inputs - #590

Merged
vcharraut merged 7 commits into
3.0from
vcha/new_obs
Sep 18, 2026
Merged

vcharraut merged 7 commits into
3.0from
vcha/new_obs

Conversation

@vcharraut

@vcharraut vcharraut commented Sep 9, 2026 •

Copy link
Copy Markdown
Collaborator

Subchanges from #580

@vcharraut
vcharraut marked this pull request as ready for review September 9, 2026 10:02
@vcharraut vcharraut changed the title Refactor observation handling: update reward coefficient comments and normalize observation indices Change observation layout: goal normalization and road inputs Sep 9, 2026
Comment thread pufferlib/ocean/drive/drive.py Outdated

self.single_observation_space = gymnasium.spaces.Box(low=-1, high=1, shape=(self.num_obs,), dtype=np.float32)

self.normalized_obs_mask = np.ones(self.num_obs, dtype=bool)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

what the function of this code is, from the variable names alone, is not self-evident to me. It also contains multiple magic numbers that are error prone


self.single_observation_space = gymnasium.spaces.Box(low=-1, high=1, shape=(self.num_obs,), dtype=np.float32)

# Observation distribution stats exclude raw traffic-control categories and valid-slot counts.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

what is a raw traffic-control category? What does it mean for it to be raw?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

the traffic control category and state are defined as follow

// -- TRAFFIC CONTROL TYPE
#define TRAFFIC_CONTROL_TYPE_NONE 0
#define TRAFFIC_CONTROL_TYPE_TRAFFIC_LIGHT 1
#define TRAFFIC_CONTROL_TYPE_STOP_SIGN 2
#define TRAFFIC_CONTROL_TYPE_YIELD_SIGN 3
#define NUM_TRAFFIC_CONTROL_TYPES 4

// -- TRAFFIC CONTROL STATE
#define TRAFFIC_CONTROL_STATE_UNKNOWN 0
#define TRAFFIC_CONTROL_STATE_RED 1
#define TRAFFIC_CONTROL_STATE_YELLOW 2
#define TRAFFIC_CONTROL_STATE_GREEN 3
#define TRAFFIC_CONTROL_STATE_OFF 4
#define NUM_TRAFFIC_CONTROL_STATES 5

then in torch.py it is converted as one-hot encoder

so the raw in the c definition

@vcharraut
vcharraut merged commit 80a681b into 3.0 Sep 18, 2026
12 checks passed
@vcharraut
vcharraut deleted the vcha/new_obs branch September 18, 2026 10:54
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.

2 participants