Skip to content

Commit

Permalink
[lfc] Use 5e-6 as double comparison espilon
Browse files Browse the repository at this point in the history
  • Loading branch information
ArthurVal committed Jan 30, 2025
1 parent a808958 commit e774618
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions tests/test_linear_feedback_controller.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -60,9 +60,9 @@ constexpr auto SuccesfullyInitialized(LinearFeedbackController& ctrl) {
};
}

constexpr auto AreAlmostEquals(double error_absolute = 1e-6) {
constexpr auto AreAlmostEquals(double abs_error) {
return [=](const auto& lhs, const auto& rhs) -> bool {
return ((lhs.array() - rhs.array()).abs() <= error_absolute).all();
return ((lhs.array() - rhs.array()).abs() <= abs_error).all();
};
}

Expand Down Expand Up @@ -276,7 +276,7 @@ TEST_P(LinearFeedbackControllerTest, ComputeControl) {
((when - first_call) / (GetParam().pd_to_lf_transition_duration));

EXPECT_PRED2(
AreAlmostEquals(1e-6),
AreAlmostEquals(5e-6),
ctrl.compute_control(when, sensor, control, false),
(((1.0 - ratio) * expected_pd_control) + (ratio * expected_lf_control)))
<< "when = " << std::quoted(str) << " | ratio = " << ratio;
Expand Down

0 comments on commit e774618

Please sign in to comment.