Skip to content

Commit

Permalink
Using angles library to wrap angles
Browse files Browse the repository at this point in the history
  • Loading branch information
ayrton04 committed Oct 24, 2022
1 parent bf02bfb commit 710d68e
Showing 1 changed file with 3 additions and 11 deletions.
14 changes: 3 additions & 11 deletions src/filter_utilities.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@
#include "robot_localization/filter_utilities.h"
#include "robot_localization/filter_common.h"

#include <angles/angles.h>

#include <string>
#include <vector>

Expand Down Expand Up @@ -128,17 +130,7 @@ namespace FilterUtilities

double clampRotation(double rotation)
{
while (rotation > PI)
{
rotation -= TAU;
}

while (rotation < -PI)
{
rotation += TAU;
}

return rotation;
return angles::normalize_angle(rotation);
}

} // namespace FilterUtilities
Expand Down

0 comments on commit 710d68e

Please sign in to comment.