Overview
The Lane Keeping Assist (LKA) is a camera sensor-based ADAS feature designed to enhance safety by preventing overspeeding into corners and assisting with lane maintenance. Usage with a steering wheel controller and pedals is recommended for the best experience.
The system operates through a multi-stage processing pipeline:
- Sensor Input: A forward-facing camera captures images (default 1280x720 resolution) to monitor the road ahead.
- Image Processing: The system applies adaptive binary thresholding to isolate lane markings. It supports detection of white lines by default, with an option to enable yellow line detection via HSV color filtering.
- Perspective Transform: The processed image is converted to a top-down perspective. This transformation allows for accurate measurement of lateral distances and road geometry.
- Lane Detection: A sliding window algorithm identifies lane pixels in the transformed image. The system then fits a second-order polynomial to these points to model the path of the lane.
- Control Logic:
- Curvature & Speed: The system calculates the radius of the road curvature from the polynomial fit. It determines a maximum safe cornering speed based on this radius and the configured risk level. If the vehicle exceeds this speed, the system automatically reduces throttle and applies brakes.
- Lane Centering: The system monitors the lateral position of the lane lines relative to the vehicle center. If the vehicle drifts towards a lane boundary, a corrective steering torque is applied to guide the driver back.
Limitations
- Activation Conditions: The system activates only at speeds above 39.6 km/h (approx. 11 m/s). It automatically disengages if hazard lights or turn signals are switched on.
- Steering Angle: To prevent interference during sharp maneuvers or intersections, the steering assist disengages if the steering angle exceeds 45 degrees.
- Lane Markings: The system relies on camera-based detection of lane markings. It requires clear, visible road lines. Poor lighting, worn markings, blind corners, or complex intersections will reduce effectiveness and/or comfort.
- Vehicle Compatibility: The control parameters are tuned specifically for the ETK800. While compatible with other vehicles, performance may vary due to differences in vehicle dimensions and handling characteristics.
- Environmental Conditions: As a camera-based system, its performance can be affected by the simulated environment’s lighting and graphics settings.
Usage
This feature is a part of the Python API. For details, please refer to the
BeamNGpy Documentation
.
For a practical example of how to use the Lane Keeping Assist in your scripts, please refer to the
BeamNGpy GitHub
.