Function heading_error

Function Documentation

float heading_error(float yaw_desired, float yaw_current)

Calculate the heading error between the current and desired yaw angles.

This function computes the heading error between the desired and current yaw angles.

Parameters:
  • yaw_desired – The desired yaw angle (in radians) based on the look-ahead point. [-π, π].

  • yaw_current – The current yaw angle (in radians), [-π, π].

Returns:

The heading error (in radians), normalized to be within the range of -π to π.