otimal
This commit is contained in:
@@ -5,6 +5,7 @@
|
||||
|
||||
#include <robot_depth_image_proc/depth_frame_filter.h>
|
||||
#include <robot_depth_image_proc/point_cloud_xyz.h>
|
||||
#include <robot_depth_image_proc/processing_rate_limiter.h>
|
||||
#include <robot_sensor_msgs/image_encodings.h>
|
||||
#include <robot_sensor_msgs/point_cloud2_iterator.h>
|
||||
|
||||
@@ -59,6 +60,50 @@ robot_sensor_msgs::Image makeFlatDepthImage(
|
||||
|
||||
} // namespace
|
||||
|
||||
TEST(ProcessingRateLimiter, LimitsWorkWithoutCatchUpBursts)
|
||||
{
|
||||
using Clock = depth_image_proc::ProcessingRateLimiter::Clock;
|
||||
using namespace std::chrono_literals;
|
||||
|
||||
depth_image_proc::ProcessingRateLimiter limiter(10.0);
|
||||
const Clock::time_point start{};
|
||||
|
||||
EXPECT_TRUE(limiter.shouldProcessAt(start));
|
||||
EXPECT_FALSE(limiter.shouldProcessAt(start + 50ms));
|
||||
EXPECT_TRUE(limiter.shouldProcessAt(start + 100ms));
|
||||
|
||||
// A late callback schedules from "now"; it does not create a catch-up burst.
|
||||
EXPECT_TRUE(limiter.shouldProcessAt(start + 350ms));
|
||||
EXPECT_FALSE(limiter.shouldProcessAt(start + 351ms));
|
||||
EXPECT_TRUE(limiter.shouldProcessAt(start + 450ms));
|
||||
}
|
||||
|
||||
TEST(ProcessingRateLimiter, NonPositiveRateDisablesLimiting)
|
||||
{
|
||||
using Clock = depth_image_proc::ProcessingRateLimiter::Clock;
|
||||
|
||||
depth_image_proc::ProcessingRateLimiter limiter(0.0);
|
||||
const Clock::time_point now{};
|
||||
EXPECT_TRUE(limiter.shouldProcessAt(now));
|
||||
EXPECT_TRUE(limiter.shouldProcessAt(now));
|
||||
|
||||
limiter.setRate(-1.0);
|
||||
EXPECT_TRUE(limiter.shouldProcessAt(now));
|
||||
}
|
||||
|
||||
TEST(ProcessingRateLimiter, AcceptsNominalFramesWithSmallClockJitter)
|
||||
{
|
||||
using Clock = depth_image_proc::ProcessingRateLimiter::Clock;
|
||||
using namespace std::chrono_literals;
|
||||
|
||||
depth_image_proc::ProcessingRateLimiter limiter(15.0);
|
||||
const Clock::time_point start{};
|
||||
|
||||
EXPECT_TRUE(limiter.shouldProcessAt(start));
|
||||
EXPECT_TRUE(limiter.shouldProcessAt(start + 65ms));
|
||||
EXPECT_TRUE(limiter.shouldProcessAt(start + 130ms));
|
||||
}
|
||||
|
||||
TEST(PointCloudXyz, ConvertsFlatDepthImage)
|
||||
{
|
||||
const uint32_t width = 3;
|
||||
|
||||
Reference in New Issue
Block a user