From eec0976aadfc8a2778d26d92ba7b7601f617b1e5 Mon Sep 17 00:00:00 2001 From: Walter Fetter Lages Date: Wed, 5 Feb 2025 04:19:38 -0300 Subject: [PATCH] Port to Jazzy. --- src/dynamics_linearizing_controller.cpp | 8 +++++--- src/twist_mrac_linearizing_controller.cpp | 8 +++++--- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/src/dynamics_linearizing_controller.cpp b/src/dynamics_linearizing_controller.cpp index 1ed47fa..a67861f 100644 --- a/src/dynamics_linearizing_controller.cpp +++ b/src/dynamics_linearizing_controller.cpp @@ -1,7 +1,7 @@ /****************************************************************************** ROS 2 linearing_controllers Package Dynamics Linearizing Controller - Copyright (C) 2014..2022 Walter Fetter Lages + Copyright (C) 2014..2025 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 @@ -213,7 +213,8 @@ namespace effort_controllers CallbackReturn DynamicsLinearizingController::on_deactivate(const rclcpp_lifecycle::State &/*previous_state*/) { for(unsigned int i=0;i < joints_.size();i++) - command_interfaces_[i].set_value(0); + if(!command_interfaces_[i].set_value(0)) + RCLCPP_WARN(get_node()->get_logger(),"Failed to set value to command interface."); return CallbackReturn::SUCCESS; } @@ -276,7 +277,8 @@ namespace effort_controllers // Apply torques for(unsigned int i=0;i < joints_.size();i++) - command_interfaces_[i].set_value(torque[i]); + if(!command_interfaces_[i].set_value(torque[i])) + RCLCPP_WARN(get_node()->get_logger(),"Failed to set value to command interface."); if(rt_status_publisher_ && rt_status_publisher_->trylock()) { diff --git a/src/twist_mrac_linearizing_controller.cpp b/src/twist_mrac_linearizing_controller.cpp index a0d1a2c..55eef20 100644 --- a/src/twist_mrac_linearizing_controller.cpp +++ b/src/twist_mrac_linearizing_controller.cpp @@ -1,7 +1,7 @@ /****************************************************************************** ROS linearing_controllers Package Twist MR(A)C Linearizing Controller - Copyright (C) 2018, 2022 Walter Fetter Lages + Copyright (C) 2018, 2025 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 @@ -255,7 +255,8 @@ namespace effort_controllers CallbackReturn TwistMracLinearizingController::on_deactivate(const rclcpp_lifecycle::State &/*previous_state*/) { for(unsigned int i=0;i < joints_.size();i++) - command_interfaces_[i].set_value(0); + if(!command_interfaces_[i].set_value(0)) + RCLCPP_WARN(get_node()->get_logger(),"Failed to set value to command interface."); return CallbackReturn::SUCCESS; } @@ -339,7 +340,8 @@ namespace effort_controllers // Apply torques for(unsigned int i=0;i < joints_.size();i++) - command_interfaces_[i].set_value(torque[i]); + if(!command_interfaces_[i].set_value(torque[i])) + RCLCPP_WARN(get_node()->get_logger(),"Failed to set value to command interface."); Eigen::Matrix W; if(adaptive_) -- 2.12.0