Skip to content

Commit

Permalink
Using angles library to normalize angles (#739)
Browse files Browse the repository at this point in the history
* Using angles library for innovation angle normalization
  • Loading branch information
firemark authored Apr 25, 2022
1 parent a737b27 commit a0c1904
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 14 deletions.
1 change: 1 addition & 0 deletions package.xml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
<depend>geographiclib</depend>
<depend>message_filters</depend>
<depend>nav_msgs</depend>
<depend>angles</depend>
<build_depend>rclcpp</build_depend>
<build_depend>rmw_implementation</build_depend>
<depend>sensor_msgs</depend>
Expand Down
9 changes: 2 additions & 7 deletions src/ekf.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@

#include <robot_localization/ekf.hpp>
#include <robot_localization/filter_common.hpp>
#include <angles/angles.h>
#include <Eigen/Dense>
#include <rclcpp/duration.hpp>
#include <vector>
Expand Down Expand Up @@ -177,13 +178,7 @@ void Ekf::correct(const Measurement & measurement)
update_indices[i] == StateMemberPitch ||
update_indices[i] == StateMemberYaw)
{
while (innovation_subset(i) < -PI) {
innovation_subset(i) += TAU;
}

while (innovation_subset(i) > PI) {
innovation_subset(i) -= TAU;
}
innovation_subset(i) = ::angles::normalize_angle(innovation_subset(i));
}
}

Expand Down
9 changes: 2 additions & 7 deletions src/ukf.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@

#include <robot_localization/filter_common.hpp>
#include <robot_localization/ukf.hpp>
#include <angles/angles.h>
#include <Eigen/Cholesky>
#include <vector>

Expand Down Expand Up @@ -244,13 +245,7 @@ void Ukf::correct(const Measurement & measurement)
update_indices[i] == StateMemberPitch ||
update_indices[i] == StateMemberYaw)
{
while (innovation_subset(i) < -PI) {
innovation_subset(i) += TAU;
}

while (innovation_subset(i) > PI) {
innovation_subset(i) -= TAU;
}
innovation_subset(i) = ::angles::normalize_angle(innovation_subset(i));
}
}

Expand Down

0 comments on commit a0c1904

Please sign in to comment.