Skip to content

Commit

Permalink
fix: fix Boost.Optional build error on Jazzy (#7602)
Browse files Browse the repository at this point in the history
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Kotaro Yoshimoto <[email protected]>
  • Loading branch information
3 people authored Oct 10, 2024
1 parent 2ab8f88 commit 1746798
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@

#include "autoware/signal_processing/lowpass_filter_1d.hpp"

#include <boost/optional/optional_io.hpp>

#include <gtest/gtest.h>

constexpr double epsilon = 1e-6;
Expand All @@ -25,7 +27,7 @@ TEST(lowpass_filter_1d, filter)
LowpassFilter1d lowpass_filter_1d(0.1);

// initial state
EXPECT_EQ(lowpass_filter_1d.getValue(), boost::none);
EXPECT_FALSE(lowpass_filter_1d.getValue());

// random filter
EXPECT_NEAR(lowpass_filter_1d.filter(0.0), 0.0, epsilon);
Expand All @@ -35,7 +37,7 @@ TEST(lowpass_filter_1d, filter)

// reset without value
lowpass_filter_1d.reset();
EXPECT_EQ(lowpass_filter_1d.getValue(), boost::none);
EXPECT_FALSE(lowpass_filter_1d.getValue());

// reset with value
lowpass_filter_1d.reset(-1.1);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@

#include "autoware/signal_processing/lowpass_filter.hpp"

#include <boost/optional/optional_io.hpp>

#include <gtest/gtest.h>

constexpr double epsilon = 1e-6;
Expand Down Expand Up @@ -41,7 +43,7 @@ TEST(lowpass_filter_twist, filter)
LowpassFilterTwist lowpass_filter_(0.1);

{ // initial state
EXPECT_EQ(lowpass_filter_.getValue(), boost::none);
EXPECT_FALSE(lowpass_filter_.getValue());
}

{ // random filter
Expand All @@ -58,7 +60,7 @@ TEST(lowpass_filter_twist, filter)

{ // reset without value
lowpass_filter_.reset();
EXPECT_EQ(lowpass_filter_.getValue(), boost::none);
EXPECT_FALSE(lowpass_filter_.getValue());
}

{ // reset with value
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@
#include "autoware/universe_utils/math/unit_conversion.hpp"
#include "object_recognition_utils/predicted_path_utils.hpp"

#include <boost/optional/optional_io.hpp>

#include <gtest/gtest.h>

using autoware::universe_utils::Point2d;
Expand Down Expand Up @@ -75,7 +77,7 @@ TEST(predicted_path_utils, testCalcInterpolatedPose)
for (double t = 0.0; t < 9.0 + 1e-6; t += 1.0) {
const auto p = calcInterpolatedPose(path, t);

EXPECT_NE(p, boost::none);
EXPECT_TRUE(p);
EXPECT_NEAR(p->position.x, t * 1.0, epsilon);
EXPECT_NEAR(p->position.y, 0.0, epsilon);
EXPECT_NEAR(p->position.z, 0.0, epsilon);
Expand All @@ -92,7 +94,7 @@ TEST(predicted_path_utils, testCalcInterpolatedPose)
for (double t = 0.0; t < 9.0; t += 0.3) {
const auto p = calcInterpolatedPose(path, t);

EXPECT_NE(p, boost::none);
EXPECT_TRUE(p);
EXPECT_NEAR(p->position.x, t * 1.0, epsilon);
EXPECT_NEAR(p->position.y, 0.0, epsilon);
EXPECT_NEAR(p->position.z, 0.0, epsilon);
Expand All @@ -108,20 +110,20 @@ TEST(predicted_path_utils, testCalcInterpolatedPose)
// Negative time
{
const auto p = calcInterpolatedPose(path, -1.0);
EXPECT_EQ(p, boost::none);
EXPECT_FALSE(p);
}

// Over the time horizon
{
const auto p = calcInterpolatedPose(path, 11.0);
EXPECT_EQ(p, boost::none);
EXPECT_FALSE(p);
}

// Empty Path
{
PredictedPath empty_path;
const auto p = calcInterpolatedPose(empty_path, 5.0);
EXPECT_EQ(p, boost::none);
EXPECT_FALSE(p);
}
}
}
Expand Down

0 comments on commit 1746798

Please sign in to comment.