Python API mode: lane keeping and steering stability metrics (right lane percentage, steering zero crossings)
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 25/100
- Issue type
- Feature
- Clarity
- Mostly clear
- Activity status
- Stale
- Tech stack
- python
- Domain
- machine-learning
Research direction
A linked pull request (#747) is already open, so check its changes in utils/controller_carla.py and utils/metrics_carla.py before taking this on. Compare the implementation with the proposed per-tick lane columns and JSON metrics; done means those outputs measure lane keeping and steering zero crossings as described.
Written by the indexing model from the issue text.
Description
Expected behavior
For follow-lane evaluation it is useful to know (1) how much of the time the vehicle drives in its own lane, in the right direction, and (2) how nervous the steering is. The current Python API metrics do not provide either.
Actual behavior
The metrics CSV has no per-tick lane information, and the JSON has no lane-keeping or steering-oscillation metric. lane_invasions counts lane-marking crossings, but not whether the vehicle is in the correct lane, and the suddenness metrics measure command changes, not oscillation around zero.
Proposal
- Five new CSV columns per tick, from the CARLA waypoint under the ego vehicle:
lane_road_id,lane_id,lane_heading_diff(vehicle yaw minus lane yaw, degrees),on_driving_laneandin_right_lane(on a Driving lane and |heading diff| < 90°; optionally also the rightmost driving lane withBM_RIGHT_LANE_MODE=rightmost). - New JSON metrics:
right_lane_percentage,off_driving_lane_percentage,steering_zero_crossingsandsteering_zero_crossings_per_second(sign changes of the applied steering ignoring |steer| <BM_STEER_DEADBAND, 0.02 by default, divided by the simulated time).
Read together: low crossings + high right-lane % = stable and correct; low + low = stable but biased; high + high = nervous corrections; high + low = unstable.
Example
PilotNet in Town02, synchronous stepping, 109 s: right_lane_percentage 94.3 %, steering_zero_crossings_per_second 0.77 (84 crossings). Another model in asynchronous mode: 53.5 % and 0.30/s, i.e. stable but biased to the left, which matched what we saw in the simulator.
Environment
Kubuntu 26.04.1 (Ubuntu base, X11 session), kernel 7.0, Intel i9-12900K, 32 GB RAM, NVIDIA RTX 5070 12 GB (driver 580.178.04), Python 3.10, CARLA 0.9.15 in Docker, Behavior Metrics noetic-devel (dec1502), Python API mode.
Implementation
Patch ready (utils/controller_carla.py +32 lines, utils/metrics_carla.py +46 lines). It applies cleanly on noetic-devel and on feature/carla-python-api-metrics. I also have a documentation section for the currently empty "Supported tasks and evaluation metrics" page.
Related
While testing I also hit two counting bugs in noetic-devel: the collision impulse and the lane invasion are never reset after being recorded, so every tick after the first event counts again (564 collisions and 2372 of 2372 rows as lane invasions in a 27 s run). Both are already fixed in feature/carla-python-api-metrics, so I did not include them here. See also #742, #744 and #745.
cc Daniel Guerrero (author of feature/carla-python-api-metrics)
- Dominant language
- Python
- Stars
- 65
- Forks
- 53
- Avg merge
- 7m
- Merged PRs (30d)
- 1
Getting set up
- No Dockerfile or Docker Compose file
- No pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from JdeRobot/BehaviorMetrics
-
Difficulty 4/5 3-5 days Newbie friendliness 45/100
JdeRobot/BehaviorMetrics#745 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 38/100
JdeRobot/BehaviorMetrics#744 ·
-
Python API mode: allow using an external CARLA server (e.g. Docker) without killing itPossibly taken @amateusr claimed this 20 days ago. Open
Difficulty 3/5 1-2 days Newbie friendliness 30/100
JdeRobot/BehaviorMetrics#741 ·
-
Broken links in Quick start CARLA on BehaviorMetrics websitePossibly taken @canveo claimed this 293 days ago. Open
Difficulty 2/5 1-3 hours Newbie friendliness 42/100
JdeRobot/BehaviorMetrics#724 · 2 comments ·
-
Add reward-based metric for policy evaluation in CARLAMay be free again @Satyamgupta2365 claimed this 284 days ago, and no pull request is open. Open
Difficulty 5/5 Over a week Newbie friendliness 30/100
JdeRobot/BehaviorMetrics#723 · 4 comments ·
All issues in JdeRobot/BehaviorMetrics
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
Maintainers usually reply within 1 day
-
[Maintainer] task area:visualizer
Difficulty 1/5 Under an hour Newbie friendliness 78/100
RailtownAI/railtracks#1824 ·
Maintainers usually reply within 3 days
-
Difficulty 2/5 1-3 hours Newbie friendliness 62/100
apache/datafusion#27688 ·
Maintainers usually reply within 1 day
-
Difficulty 1/5 Under an hour Newbie friendliness 88/100
heasarc/heasarc-tutorials#317 ·
-
bug good first issue help wanted
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
mloda-ai/mloda-registry#1664 ·
Maintainers usually reply within 1 day