Skip to content

Commit

Permalink
Actually update timer period
Browse files Browse the repository at this point in the history
Signed-off-by: Ivan Santiago Paunovic <ivanpauno@ekumenlabs.com>
  • Loading branch information
ivanpauno committed May 14, 2020
1 parent 1871574 commit 06e8d84
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
1 change: 0 additions & 1 deletion rclcpp/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -604,7 +604,6 @@ if(BUILD_TESTING)
ament_target_dependencies(test_multi_threaded_executor
"rcl")
target_link_libraries(test_multi_threaded_executor ${PROJECT_NAME})
ament_add_test_label(test_multi_threaded_executor xfail)
endif()

ament_add_gtest(test_guard_condition test/test_guard_condition.cpp
Expand Down
9 changes: 5 additions & 4 deletions rclcpp/test/executors/test_multi_threaded_executor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,10 @@ class TestMultiThreadedExecutor : public ::testing::Test
}
};

constexpr double PERIOD = 1.0f;
constexpr double TOLERANCE = 0.25f;
constexpr std::chrono::milliseconds PERIOD_MS = 1000ms;

/*
Test that timers are not taken multiple times when using reentrant callback groups.
*/
Expand Down Expand Up @@ -70,9 +74,6 @@ TEST_F(TestMultiThreadedExecutor, timer_over_take) {
// While this tolerance is a little wide, if the bug occurs, the next step will
// happen almost instantly. The purpose of this test is not to measure the jitter
// in timers, just assert that a reasonable amount of time has passed.
const double PERIOD = 1.0f;
const double TOLERANCE = 0.25f;

rclcpp::Time now = system_clock.now();
timer_count++;

Expand All @@ -93,7 +94,7 @@ TEST_F(TestMultiThreadedExecutor, timer_over_take) {
}
};

auto timer = node->create_wall_timer(100ms, timer_callback, cbg);
auto timer = node->create_wall_timer(PERIOD_MS, timer_callback, cbg);
executor.add_node(node);
executor.spin();
}

0 comments on commit 06e8d84

Please sign in to comment.