In autonomous driving and robotics, predicting how a vehicle will move given control inputs is fundamental for path planning, trajectory tracking, and simulation. The kinematic bicycle model is a widely-used simplification that treats a four-wheeled vehicle as a two-wheeled bicycle, capturing the essential turning geometry.
Implement the function kinematic_vehicle_model(initial_state, controls, wheelbase, dt) that simulates a vehicle's trajectory over multiple time steps using Euler integration.
State variables at each time step:
x: x-position in metersy: y-position in meterstheta: heading angle in radiansv: velocity in meters per secondControl inputs at each time step:
acceleration: longitudinal acceleration (m/s^2)steering_angle: front wheel steering angle (radians)Parameters:
wheelbase: distance between front and rear axles (meters)dt: simulation time step (seconds)The function should return a numpy array of shape (N+1, 4) containing the full trajectory including the initial state, where N is the number of control steps. Each row contains [x, y, theta, v].
The vehicle's position and heading evolve based on its current velocity, heading, and the steering geometry of the bicycle model. Use forward Euler integration to propagate the state at each time step.