Design a basic algorithm for a self-driving car to perform lane keeping on a straight road.
Instruction: Outline the steps your algorithm would take to ensure the vehicle stays within its lane, considering inputs from cameras and/or sensors.
Updated
Example Answer
For a simulation-only lane-keeping exercise, I would estimate a lane centerline in a calibrated road frame, then compute lateral and heading error for a bounded controller. An image midpoint alone is not a metric road error because perspective and camera pose matter. Limit steering and rate of change, specify the speed range, and handle missing or unreliable lane estimates explicitly. This educational controller is not a road-ready autonomous driving system.
Make it your own
Illustrative simulation cases: centered vehicle, lateral offset, heading offset, one missing boundary and saturated steering. Record the controller response and the condition that ends the exercise safely.
Why this works
The coordinate frame and limits make the algorithm testable without implying public-road suitability. Follow-up: why can zero lateral error still require steering when heading error is nonzero?
Sources: OpenCV camera calibration, NHTSA ADS safety guidance.