Function speed_proportional_steering

Function Documentation

float speed_proportional_steering(float steering_angle, float max_steering, float max_speed, float min_speed)

Calculates the speed of a vehicle proportional to the steering angle.

This function computes the speed of a vehicle using a proportional control algorithm based on the steering angle. The speed decreases linearly as the steering angle increases, ensuring that the vehicle slows down when making sharper turns.

Parameters:
  • steering_angle – The current steering angle of the vehicle.

  • max_steering – The maximum steering angle the vehicle can achieve.

  • max_speed – The maximum speed the vehicle can achieve.

  • min_speed – The minimum speed the vehicle should maintain.

Returns:

The calculated speed of the vehicle based on the steering angle.