Skip to content

Commit

Permalink
Use a thread priority library from realtime_tools (#794)
Browse files Browse the repository at this point in the history
Co-authored-by: Denis Štogl <[email protected]>
Co-authored-by: Bence Magyar <[email protected]>
  • Loading branch information
3 people authored Nov 26, 2022
1 parent 0cae740 commit 2a1f74e
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 85 deletions.
7 changes: 4 additions & 3 deletions controller_manager/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ set(THIS_PACKAGE_INCLUDE_DEPENDS
hardware_interface
pluginlib
rclcpp
realtime_tools
)

find_package(ament_cmake REQUIRED)
Expand All @@ -24,7 +25,6 @@ endforeach()

add_library(${PROJECT_NAME} SHARED
src/controller_manager.cpp
src/realtime.cpp
)
target_include_directories(${PROJECT_NAME} PRIVATE include)
ament_target_dependencies(${PROJECT_NAME} ${THIS_PACKAGE_INCLUDE_DEPENDS})
Expand All @@ -34,7 +34,9 @@ target_compile_definitions(${PROJECT_NAME} PRIVATE "CONTROLLER_MANAGER_BUILDING_

add_executable(ros2_control_node src/ros2_control_node.cpp)
target_include_directories(ros2_control_node PRIVATE include)
target_link_libraries(ros2_control_node ${PROJECT_NAME})
target_link_libraries(ros2_control_node
${PROJECT_NAME}
)
ament_target_dependencies(ros2_control_node ${THIS_PACKAGE_INCLUDE_DEPENDS})

install(TARGETS ${PROJECT_NAME}
Expand All @@ -54,7 +56,6 @@ install(DIRECTORY include/
if(BUILD_TESTING)
find_package(ament_cmake_gmock REQUIRED)
find_package(ros2_control_test_assets REQUIRED)
find_package(realtime_tools REQUIRED)

add_library(test_controller SHARED test/test_controller/test_controller.cpp)
target_include_directories(test_controller PRIVATE include)
Expand Down
35 changes: 0 additions & 35 deletions controller_manager/include/controller_manager/realtime.hpp

This file was deleted.

2 changes: 1 addition & 1 deletion controller_manager/package.xml
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,12 @@
<depend>pluginlib</depend>
<depend>rclcpp</depend>
<depend>rcpputils</depend>
<depend>realtime_tools</depend>
<depend>ros2_control_test_assets</depend>
<depend>ros2param</depend>
<depend>ros2run</depend>

<test_depend>ament_cmake_gmock</test_depend>
<test_depend>realtime_tools</test_depend>

<export>
<build_type>ament_cmake</build_type>
Expand Down
43 changes: 0 additions & 43 deletions controller_manager/src/realtime.cpp

This file was deleted.

6 changes: 3 additions & 3 deletions controller_manager/src/ros2_control_node.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@
#include <thread>

#include "controller_manager/controller_manager.hpp"
#include "controller_manager/realtime.hpp"
#include "rclcpp/rclcpp.hpp"
#include "realtime_tools/thread_priority.hpp"

using namespace std::chrono_literals;

Expand Down Expand Up @@ -48,9 +48,9 @@ int main(int argc, char ** argv)
std::thread cm_thread(
[cm]()
{
if (controller_manager::has_realtime_kernel())
if (realtime_tools::has_realtime_kernel())
{
if (!controller_manager::configure_sched_fifo(kSchedPriority))
if (!realtime_tools::configure_sched_fifo(kSchedPriority))
{
RCLCPP_WARN(cm->get_logger(), "Could not enable FIFO RT scheduling policy");
}
Expand Down

0 comments on commit 2a1f74e

Please sign in to comment.