Template Function mppi::utils::shortest_angular_distance

Function Documentation

template<typename F, typename T>
auto mppi::utils::shortest_angular_distance(const F &from, const T &to)

shortest_angular_distance

Given 2 angles, this returns the shortest angular difference. The inputs and ouputs are of course radians.

The result would always be -pi <= result <= pi. Adding the result to “from” will always get you an equivelent angle to “to”.

Parameters:
  • from – Start angle

  • to – End angle

Returns:

Shortest distance between angles