Speed limit and lane center/angle observation#289
Speed limit and lane center/angle observation#289Aditya-Gupta26 wants to merge 5 commits into3.0_betafrom
Conversation
Greptile OverviewGreptile SummaryThis PR extends the ego observation for both dynamics models by adding (1) a speed-limit feature (currently hardcoded) and (2) lane-center distance + lane-angle alignment computed from the closest lane segment with a small multi-segment heading smoothing. The C simulator ( Key integration risk: Confidence Score: 2/5
Important Files Changed
Sequence DiagramsequenceDiagram
participant PyEnv as drive.py (Gym env)
participant CEnv as drive.h (C sim)
participant Agent as Agent/metrics_array
participant Policy as torch.py (NN policy)
PyEnv->>CEnv: allocate() uses EGO_FEATURES_* to size observations
loop each step
CEnv->>CEnv: compute_agent_metrics(agent)
CEnv->>Agent: write metrics_array[LANE_DIST_IDX], [LANE_ANGLE_IDX]
CEnv->>CEnv: compute_observations()
CEnv->>CEnv: obs[ego] includes speed_limit, lane_center_dist, lane_angle
CEnv-->>PyEnv: observations buffer
PyEnv->>Policy: forward(observations)
Policy->>Policy: slice using env.ego_features
end
|
| // Metrics array indices | ||
| #define COLLISION_IDX 0 | ||
| #define OFFROAD_IDX 1 | ||
| #define REACHED_GOAL_IDX 2 | ||
| #define LANE_ALIGNED_IDX 3 | ||
| #define RED_LIGHT_IDX 2 | ||
| #define REACHED_GOAL_IDX 3 | ||
| #define LANE_DIST_IDX 4 | ||
| #define LANE_ANGLE_IDX 5 | ||
| #define COMFORT_VIOLATION_IDX 6 | ||
| #define VELOCITY_PROGRESS_IDX 7 | ||
| #define SPEED_LIMIT_IDX 8 | ||
| #define AVG_DISPLACEMENT_ERROR_IDX 9 | ||
| #define LANE_ALIGNED_IDX 10 |
There was a problem hiding this comment.
Metrics indices now mismatch
metrics_array is resized to 11 in datatypes.h, but the new indices in drive.h imply you’re now writing up to index 10 (LANE_ALIGNED_IDX). Existing comments in Agent still describe only 10 items, and several reset/respawn paths only clear a subset of indices. This will leave stale values (e.g., LANE_DIST_IDX, LANE_ANGLE_IDX) across steps/episodes and makes the meaning of each index ambiguous. Please update the Agent comment to list all 11 entries and ensure all codepaths that reset metrics zero the full [0..LANE_ALIGNED_IDX] range (or explicitly initialize new slots).
Additional Comments (4)
The new “best candidate” lane selection updates
In
|
This PR adds the following -
These are added onto the observation vector for both JERK and CLASSIC dynamic models
(This is derived from Turbocharge PR)
Note : This PR is not meant to add reward conditioning for lane/speed alignment as of yet. That will be catered to in a separate PR