From: Walter Fetter Lages Date: Sat, 5 Sep 2026 22:19:35 +0000 (-0300) Subject: Port to Lyrical. X-Git-Url: http://git.ece.ufrgs.br/?a=commitdiff_plain;h=371a803ec570774f11936a905dea4f44c41d3858;p=computed_torque_controller.git Port to Lyrical. --- diff --git a/CMakeLists.txt b/CMakeLists.txt index 24fb9a9..0297793 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.8) +cmake_minimum_required(VERSION 3.20) project(computed_torque_controller) if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang") @@ -18,18 +18,18 @@ find_package(orocos_kdl REQUIRED) find_package(realtime_tools REQUIRED) add_library(computed_torque_controller SHARED src/computed_torque_controller.cpp) -target_compile_features(computed_torque_controller PUBLIC c_std_99 cxx_std_17) # Require C99 and C++17 +target_compile_features(computed_torque_controller PUBLIC c_std_17 cxx_std_20) # Require C17 and C++20 target_include_directories(computed_torque_controller PRIVATE include) -ament_target_dependencies( +target_link_libraries( computed_torque_controller - "rclcpp" - "controller_interface" - "controller_manager" - "trajectory_msgs" - "urdf" - "kdl_parser" - "orocos_kdl" - "realtime_tools" + ${rclcpp_TARGETS} + ${controller_interface_TARGETS} + ${controller_manager_TARGETS} + ${trajectory_msgs_TARGETS} + ${urdf_TARGETS} + ${kdl_parser_TARGETS} + ${orocos_kdl_TARGETS} + ${realtime_tools_TARGETS} ) # Causes the visibility macros to use dllexport rather than dllimport, diff --git a/computed_torque_controller_plugin.xml b/computed_torque_controller_plugin.xml index 2d77942..4338be4 100644 --- a/computed_torque_controller_plugin.xml +++ b/computed_torque_controller_plugin.xml @@ -1,6 +1,6 @@ - The ComputedTorqueController implements a computed torque controller diff --git a/include/computed_torque_controller/computed_torque_controller.hpp b/include/computed_torque_controller/computed_torque_controller.hpp index 95c7de8..fa61d47 100644 --- a/include/computed_torque_controller/computed_torque_controller.hpp +++ b/include/computed_torque_controller/computed_torque_controller.hpp @@ -1,7 +1,7 @@ /****************************************************************************** ROS 2 computed_torque_controller Package Computed Torque Controller - Copyright (C) 2013..2025 Walter Fetter Lages + Copyright (C) 2013..2026 Walter Fetter Lages This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -34,7 +34,7 @@ #include -namespace effort_controllers +namespace computed_torque_controller { class ComputedTorqueController: public controller_interface::ControllerInterface { diff --git a/package.xml b/package.xml index 977fea7..e4e2b31 100644 --- a/package.xml +++ b/package.xml @@ -2,7 +2,7 @@ computed_torque_controller - 2.1.0 + 2.2.0 The computed_torque_controller package implements a computed torque controller in joint space Walter Fetter Lages GPL-3.0-only diff --git a/src/computed_torque_controller.cpp b/src/computed_torque_controller.cpp index 5bd0790..1840b18 100644 --- a/src/computed_torque_controller.cpp +++ b/src/computed_torque_controller.cpp @@ -1,7 +1,7 @@ /****************************************************************************** ROS 2 computed_torque_controller Package Computed Torque Controller - Copyright (C) 2013..2025 Walter Fetter Lages + Copyright (C) 2013..2026 Walter Fetter Lages This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -28,7 +28,7 @@ #include -namespace effort_controllers +namespace computed_torque_controller { ComputedTorqueController::ComputedTorqueController(void): q_(0),dq_(0),v_(0),qr_(0),dqr_(0),ddqr_(0),torque_(0),fext_(0),referencePoint_(nullptr) @@ -62,10 +62,11 @@ namespace effort_controllers rclcpp::QoS qos(rclcpp::KeepLast(1)); qos.transient_local(); auto robotDescriptionSubscriber=get_node()->create_subscription("robot_description",qos,std::bind(&ComputedTorqueController::robotDescriptionCB,this,std::placeholders::_1)); + rclcpp::executors::SingleThreadedExecutor executor; while(robotDescription_.empty()) { RCLCPP_WARN_SKIPFIRST_THROTTLE(get_node()->get_logger(),*get_node()->get_clock(),1000,"Waiting for robot model on /robot_description."); - rclcpp::spin_some(get_node()->get_node_base_interface()); + executor.spin_node_some(get_node()->get_node_base_interface()); } return controller_interface::CallbackReturn::SUCCESS; @@ -242,7 +243,6 @@ namespace effort_controllers for(unsigned int i=0;i < nJoints_;i++) if(!command_interfaces_[i].set_value(torque_(i))) RCLCPP_ERROR(get_node()->get_logger(),"Can't set command value.."); - return controller_interface::return_type::OK; } @@ -257,4 +257,4 @@ namespace effort_controllers } } -PLUGINLIB_EXPORT_CLASS(effort_controllers::ComputedTorqueController,controller_interface::ControllerInterface) +PLUGINLIB_EXPORT_CLASS(computed_torque_controller::ComputedTorqueController,controller_interface::ControllerInterface)