From 8939ace7cf417074d510b3a1114431ea5ef155ab Mon Sep 17 00:00:00 2001 From: Stefan Scherzinger Date: Thu, 13 Jul 2023 16:39:53 +0200 Subject: [PATCH 1/9] Use the license's SPDX specifier This is more precise of what we are actually using and follows the recommendations from here: https://spdx.org/licenses/BSD-3-Clause.html --- cartesian_compliance_controller/package.xml | 2 +- cartesian_controller_base/package.xml | 2 +- cartesian_controller_examples/package.xml | 3 +-- cartesian_controller_handles/package.xml | 2 +- cartesian_controller_simulation/package.xml | 2 +- cartesian_controller_tests/package.xml | 2 +- cartesian_controller_utilities/package.xml | 2 +- cartesian_force_controller/package.xml | 2 +- cartesian_motion_controller/package.xml | 2 +- joint_to_cartesian_controller/package.xml | 3 +-- 10 files changed, 10 insertions(+), 12 deletions(-) diff --git a/cartesian_compliance_controller/package.xml b/cartesian_compliance_controller/package.xml index 90cfcd34..b25e3986 100644 --- a/cartesian_compliance_controller/package.xml +++ b/cartesian_compliance_controller/package.xml @@ -5,7 +5,7 @@ 0.0.0 Control your robot through Cartesian target poses and target wrenches scherzin - BSD + BSD-3-Clause https://github.com/fzi-forschungszentrum-informatik/cartesian_controllers Stefan Scherzinger diff --git a/cartesian_controller_base/package.xml b/cartesian_controller_base/package.xml index ba429c89..c3b9ee19 100644 --- a/cartesian_controller_base/package.xml +++ b/cartesian_controller_base/package.xml @@ -5,7 +5,7 @@ 0.0.0 The cartesian_controller_base package scherzin - BSD + BSD-3-Clause https://github.com/fzi-forschungszentrum-informatik/cartesian_controllers Stefan Scherzinger diff --git a/cartesian_controller_examples/package.xml b/cartesian_controller_examples/package.xml index dc678b93..de2c4ff4 100644 --- a/cartesian_controller_examples/package.xml +++ b/cartesian_controller_examples/package.xml @@ -11,8 +11,7 @@ - - BSD + BSD-3-Clause diff --git a/cartesian_controller_handles/package.xml b/cartesian_controller_handles/package.xml index f6fce3fb..57ea0b3e 100644 --- a/cartesian_controller_handles/package.xml +++ b/cartesian_controller_handles/package.xml @@ -5,7 +5,7 @@ 0.0.0 The cartesian_controller_handles package scherzin - BSD + BSD-3-Clause https://github.com/fzi-forschungszentrum-informatik/cartesian_controllers Stefan Scherzinger diff --git a/cartesian_controller_simulation/package.xml b/cartesian_controller_simulation/package.xml index 61210d68..c7b4a2b2 100644 --- a/cartesian_controller_simulation/package.xml +++ b/cartesian_controller_simulation/package.xml @@ -5,7 +5,7 @@ 0.0.0 A simulation environment for cartesian_controllers scherzin - BSD + BSD-3-Clause ament_cmake diff --git a/cartesian_controller_tests/package.xml b/cartesian_controller_tests/package.xml index e506d80c..e81ecca4 100644 --- a/cartesian_controller_tests/package.xml +++ b/cartesian_controller_tests/package.xml @@ -5,7 +5,7 @@ 0.1.0 Integration tests for the Cartesian controllers Stefan Scherzinger - BSD + BSD-3-Clause Stefan Scherzinger launch diff --git a/cartesian_controller_utilities/package.xml b/cartesian_controller_utilities/package.xml index 340cc32b..1e9c3cac 100644 --- a/cartesian_controller_utilities/package.xml +++ b/cartesian_controller_utilities/package.xml @@ -5,7 +5,7 @@ 0.1.0 Make the spacemouse a teach device for contact-based teleoperation Stefan Scherzinger - BSD + BSD-3-Clause Stefan Scherzinger ament_cmake diff --git a/cartesian_force_controller/package.xml b/cartesian_force_controller/package.xml index b4df948b..ab4e4939 100644 --- a/cartesian_force_controller/package.xml +++ b/cartesian_force_controller/package.xml @@ -5,7 +5,7 @@ 0.0.0 The cartesian_force_controller package scherzin - BSD + BSD-3-Clause https://github.com/fzi-forschungszentrum-informatik/cartesian_controllers Stefan Scherzinger diff --git a/cartesian_motion_controller/package.xml b/cartesian_motion_controller/package.xml index 7d6b7136..9f57d969 100644 --- a/cartesian_motion_controller/package.xml +++ b/cartesian_motion_controller/package.xml @@ -5,7 +5,7 @@ 0.0.0 The cartesian_motion_controller package scherzin - BSD + BSD-3-Clause https://github.com/fzi-forschungszentrum-informatik/cartesian_controllers Stefan Scherzinger diff --git a/joint_to_cartesian_controller/package.xml b/joint_to_cartesian_controller/package.xml index 0fcfa032..db6e578c 100644 --- a/joint_to_cartesian_controller/package.xml +++ b/joint_to_cartesian_controller/package.xml @@ -11,8 +11,7 @@ - - BSD + BSD-3-Clause From fdaa9a2dd0ce15fc949b127dd1164095504273fb Mon Sep 17 00:00:00 2001 From: Stefan Scherzinger Date: Thu, 13 Jul 2023 17:30:19 +0200 Subject: [PATCH 2/9] Fix `test_joint_control.py`'s license Thanks @ct2034 for [this tool](https://github.com/boschresearch/ros_license_toolkit). --- .../scripts/test_joint_control.py | 36 +++++++++++++------ 1 file changed, 26 insertions(+), 10 deletions(-) diff --git a/cartesian_controller_simulation/scripts/test_joint_control.py b/cartesian_controller_simulation/scripts/test_joint_control.py index f716d478..d03d698a 100755 --- a/cartesian_controller_simulation/scripts/test_joint_control.py +++ b/cartesian_controller_simulation/scripts/test_joint_control.py @@ -2,17 +2,33 @@ ################################################################################ # Copyright 2022 FZI Research Center for Information Technology # -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are met: # -# http://www.apache.org/licenses/LICENSE-2.0 +# 1. Redistributions of source code must retain the above copyright notice, +# this list of conditions and the following disclaimer. # -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. +# 2. Redistributions in binary form must reproduce the above copyright notice, +# this list of conditions and the following disclaimer in the documentation +# and/or other materials provided with the distribution. +# +# 3. Neither the name of the copyright holder nor the names of its +# contributors may be used to endorse or promote products derived from this +# software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +# POSSIBILITY OF SUCH DAMAGE. +################################################################################ + """ Bring our test robot into a predefined joint configuration @@ -65,7 +81,7 @@ def gui(self): """ A GUI with a single slider for opening/closing the JointGui """ self.percent = 100 self.window = Tk() - self.window.title('Schunk SVH') + self.window.title('joint_gui') self.slider = Scale(self.window, from_=self.percent, to=0) self.slider.set(0) self.slider.bind("", self.slider_changed) From a7bbee50faf4ef3fed5ef2fe2857683fb15d14d3 Mon Sep 17 00:00:00 2001 From: Stefan Scherzinger Date: Mon, 31 Jul 2023 14:52:18 +0200 Subject: [PATCH 3/9] Update README.md Add a link to my Universal Robots getting started package. --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 06b83cb1..0f90e1f2 100644 --- a/README.md +++ b/README.md @@ -64,6 +64,7 @@ and try things. Here are some quick tutorials with further details: - [Cartesian compliance controller](cartesian_compliance_controller/README.md) - [Cartesian controller handles](cartesian_controller_handles/README.md) - [Teleoperation](cartesian_controller_utilities/README.md) +- [Example on Universal Robots](https://github.com/stefanscherzinger/cartesian_controllers_universal_robots/tree/ros2) ## Citation and further reading If you use the *cartesian_controllers* in your research projects, please From 8a038f04da9da8bfe628169c2d7366dfd6d1e0d7 Mon Sep 17 00:00:00 2001 From: Stefan Scherzinger Date: Thu, 21 Sep 2023 17:59:44 +0200 Subject: [PATCH 4/9] Remove *testing* ci pipelines for unsupported versions There won't be any development on deprecated versions, so drop them and keep the CI a little more light-weight. --- .github/workflows/industrial_ci_foxy_action.yml | 1 - .github/workflows/industrial_ci_galactic_action.yml | 1 - 2 files changed, 2 deletions(-) diff --git a/.github/workflows/industrial_ci_foxy_action.yml b/.github/workflows/industrial_ci_foxy_action.yml index 44bf7b8c..0e5d0337 100644 --- a/.github/workflows/industrial_ci_foxy_action.yml +++ b/.github/workflows/industrial_ci_foxy_action.yml @@ -11,7 +11,6 @@ jobs: fail-fast: false matrix: env: - - {ROS_DISTRO: foxy, ROS_REPO: testing} - {ROS_DISTRO: foxy, ROS_REPO: main} runs-on: ubuntu-latest steps: diff --git a/.github/workflows/industrial_ci_galactic_action.yml b/.github/workflows/industrial_ci_galactic_action.yml index 974e9bc1..294821c4 100644 --- a/.github/workflows/industrial_ci_galactic_action.yml +++ b/.github/workflows/industrial_ci_galactic_action.yml @@ -11,7 +11,6 @@ jobs: fail-fast: false matrix: env: - - {ROS_DISTRO: galactic, ROS_REPO: testing} - {ROS_DISTRO: galactic, ROS_REPO: main} runs-on: ubuntu-latest steps: From 7e6957f8d9e5a9733dcb3a4bc6bf86dd00411f75 Mon Sep 17 00:00:00 2001 From: Fynn Kriesel Date: Tue, 4 Jul 2023 14:36:15 +0200 Subject: [PATCH 5/9] make ros-iron behave like ros-humble --- .../cartesian_compliance_controller.h | 4 ++-- .../src/cartesian_compliance_controller.cpp | 4 ++-- cartesian_controller_base/CMakeLists.txt | 4 +++- .../cartesian_controller_base/DampedLeastSquaresSolver.h | 2 +- .../cartesian_controller_base/ForwardDynamicsSolver.h | 2 +- .../include/cartesian_controller_base/IKSolver.h | 2 +- .../cartesian_controller_base/JacobianTransposeSolver.h | 2 +- .../include/cartesian_controller_base/PDController.h | 4 ++-- .../cartesian_controller_base/ROS2VersionConfig.h.in | 1 + .../SelectivelyDampedLeastSquaresSolver.h | 2 +- .../cartesian_controller_base/SpatialPDController.h | 2 +- .../cartesian_controller_base/cartesian_controller_base.h | 2 +- .../src/DampedLeastSquaresSolver.cpp | 2 +- cartesian_controller_base/src/ForwardDynamicsSolver.cpp | 2 +- cartesian_controller_base/src/IKSolver.cpp | 2 +- cartesian_controller_base/src/JacobianTransposeSolver.cpp | 2 +- cartesian_controller_base/src/PDController.cpp | 2 +- .../src/SelectivelyDampedLeastSquaresSolver.cpp | 2 +- cartesian_controller_base/src/SpatialPDController.cpp | 2 +- .../src/cartesian_controller_base.cpp | 4 ++-- .../cartesian_force_controller.h | 4 ++-- .../src/cartesian_force_controller.cpp | 8 ++++---- .../cartesian_motion_controller.h | 4 ++-- .../src/cartesian_motion_controller.cpp | 4 ++-- 24 files changed, 36 insertions(+), 33 deletions(-) diff --git a/cartesian_compliance_controller/include/cartesian_compliance_controller/cartesian_compliance_controller.h b/cartesian_compliance_controller/include/cartesian_compliance_controller/cartesian_compliance_controller.h index 93546908..97135984 100644 --- a/cartesian_compliance_controller/include/cartesian_compliance_controller/cartesian_compliance_controller.h +++ b/cartesian_compliance_controller/include/cartesian_compliance_controller/cartesian_compliance_controller.h @@ -76,7 +76,7 @@ class CartesianComplianceController public: CartesianComplianceController(); -#if defined CARTESIAN_CONTROLLERS_GALACTIC || defined CARTESIAN_CONTROLLERS_HUMBLE +#if defined CARTESIAN_CONTROLLERS_GALACTIC || defined CARTESIAN_CONTROLLERS_HUMBLE || defined CARTESIAN_CONTROLLERS_IRON virtual LifecycleNodeInterface::CallbackReturn on_init() override; #elif defined CARTESIAN_CONTROLLERS_FOXY virtual controller_interface::return_type init(const std::string & controller_name) override; @@ -91,7 +91,7 @@ class CartesianComplianceController rclcpp_lifecycle::node_interfaces::LifecycleNodeInterface::CallbackReturn on_deactivate( const rclcpp_lifecycle::State & previous_state) override; -#if defined CARTESIAN_CONTROLLERS_GALACTIC || defined CARTESIAN_CONTROLLERS_HUMBLE +#if defined CARTESIAN_CONTROLLERS_GALACTIC || defined CARTESIAN_CONTROLLERS_HUMBLE || defined CARTESIAN_CONTROLLERS_IRON controller_interface::return_type update(const rclcpp::Time & time, const rclcpp::Duration & period) override; #elif defined CARTESIAN_CONTROLLERS_FOXY controller_interface::return_type update() override; diff --git a/cartesian_compliance_controller/src/cartesian_compliance_controller.cpp b/cartesian_compliance_controller/src/cartesian_compliance_controller.cpp index 76c0f0ec..1069908a 100644 --- a/cartesian_compliance_controller/src/cartesian_compliance_controller.cpp +++ b/cartesian_compliance_controller/src/cartesian_compliance_controller.cpp @@ -53,7 +53,7 @@ CartesianComplianceController::CartesianComplianceController() { } -#if defined CARTESIAN_CONTROLLERS_GALACTIC || defined CARTESIAN_CONTROLLERS_HUMBLE +#if defined CARTESIAN_CONTROLLERS_GALACTIC || defined CARTESIAN_CONTROLLERS_HUMBLE || defined CARTESIAN_CONTROLLERS_IRON rclcpp_lifecycle::node_interfaces::LifecycleNodeInterface::CallbackReturn CartesianComplianceController::on_init() { using TYPE = rclcpp_lifecycle::node_interfaces::LifecycleNodeInterface::CallbackReturn; @@ -140,7 +140,7 @@ rclcpp_lifecycle::node_interfaces::LifecycleNodeInterface::CallbackReturn Cartes return TYPE::SUCCESS; } -#if defined CARTESIAN_CONTROLLERS_GALACTIC || defined CARTESIAN_CONTROLLERS_HUMBLE +#if defined CARTESIAN_CONTROLLERS_GALACTIC || defined CARTESIAN_CONTROLLERS_HUMBLE || defined CARTESIAN_CONTROLLERS_IRON controller_interface::return_type CartesianComplianceController::update(const rclcpp::Time& time, const rclcpp::Duration& period) #elif defined CARTESIAN_CONTROLLERS_FOXY diff --git a/cartesian_controller_base/CMakeLists.txt b/cartesian_controller_base/CMakeLists.txt index 817281e9..0989db1f 100644 --- a/cartesian_controller_base/CMakeLists.txt +++ b/cartesian_controller_base/CMakeLists.txt @@ -8,7 +8,9 @@ add_compile_options(${ADDITIONAL_COMPILE_OPTIONS}) # Use CMake to pass the current ROS_DISTRO via variables into a preprocessor template. # We then include this file and switch between the API for foxy and galactic. -if($ENV{ROS_DISTRO} STREQUAL "humble") +if($ENV{ROS_DISTRO} STREQUAL "iron") + set(CARTESIAN_CONTROLLERS_IRON TRUE) +elseif($ENV{ROS_DISTRO} STREQUAL "humble") set(CARTESIAN_CONTROLLERS_HUMBLE TRUE) elseif($ENV{ROS_DISTRO} STREQUAL "galactic") set(CARTESIAN_CONTROLLERS_GALACTIC TRUE) diff --git a/cartesian_controller_base/include/cartesian_controller_base/DampedLeastSquaresSolver.h b/cartesian_controller_base/include/cartesian_controller_base/DampedLeastSquaresSolver.h index 541a70e4..b3a18673 100644 --- a/cartesian_controller_base/include/cartesian_controller_base/DampedLeastSquaresSolver.h +++ b/cartesian_controller_base/include/cartesian_controller_base/DampedLeastSquaresSolver.h @@ -92,7 +92,7 @@ class DampedLeastSquaresSolver : public IKSolver * * \return True, if everything went well */ -#if defined CARTESIAN_CONTROLLERS_HUMBLE +#if defined CARTESIAN_CONTROLLERS_HUMBLE || defined CARTESIAN_CONTROLLERS_IRON bool init(std::shared_ptr nh, #else bool init(std::shared_ptr nh, diff --git a/cartesian_controller_base/include/cartesian_controller_base/ForwardDynamicsSolver.h b/cartesian_controller_base/include/cartesian_controller_base/ForwardDynamicsSolver.h index 4d4fdb84..ddcce705 100644 --- a/cartesian_controller_base/include/cartesian_controller_base/ForwardDynamicsSolver.h +++ b/cartesian_controller_base/include/cartesian_controller_base/ForwardDynamicsSolver.h @@ -103,7 +103,7 @@ class ForwardDynamicsSolver : public IKSolver * * @return True, if everything went well */ -#if defined CARTESIAN_CONTROLLERS_HUMBLE +#if defined CARTESIAN_CONTROLLERS_HUMBLE || defined CARTESIAN_CONTROLLERS_IRON bool init(std::shared_ptr nh, #else bool init(std::shared_ptr nh, diff --git a/cartesian_controller_base/include/cartesian_controller_base/IKSolver.h b/cartesian_controller_base/include/cartesian_controller_base/IKSolver.h index 186571b3..9423dc90 100644 --- a/cartesian_controller_base/include/cartesian_controller_base/IKSolver.h +++ b/cartesian_controller_base/include/cartesian_controller_base/IKSolver.h @@ -146,7 +146,7 @@ class IKSolver * * @return True, if everything went well */ -#if defined CARTESIAN_CONTROLLERS_HUMBLE +#if defined CARTESIAN_CONTROLLERS_HUMBLE || defined CARTESIAN_CONTROLLERS_IRON virtual bool init(std::shared_ptr nh, #else virtual bool init(std::shared_ptr nh, diff --git a/cartesian_controller_base/include/cartesian_controller_base/JacobianTransposeSolver.h b/cartesian_controller_base/include/cartesian_controller_base/JacobianTransposeSolver.h index 5c822222..2a60ecd4 100644 --- a/cartesian_controller_base/include/cartesian_controller_base/JacobianTransposeSolver.h +++ b/cartesian_controller_base/include/cartesian_controller_base/JacobianTransposeSolver.h @@ -87,7 +87,7 @@ class JacobianTransposeSolver : public IKSolver * * \return True, if everything went well */ -#if defined CARTESIAN_CONTROLLERS_HUMBLE +#if defined CARTESIAN_CONTROLLERS_HUMBLE || defined CARTESIAN_CONTROLLERS_IRON bool init(std::shared_ptr /*nh*/, #else bool init(std::shared_ptr /*nh*/, diff --git a/cartesian_controller_base/include/cartesian_controller_base/PDController.h b/cartesian_controller_base/include/cartesian_controller_base/PDController.h index a574d841..4da4ad77 100644 --- a/cartesian_controller_base/include/cartesian_controller_base/PDController.h +++ b/cartesian_controller_base/include/cartesian_controller_base/PDController.h @@ -64,7 +64,7 @@ class PDController PDController(); ~PDController(); -#if defined CARTESIAN_CONTROLLERS_HUMBLE +#if defined CARTESIAN_CONTROLLERS_HUMBLE || defined CARTESIAN_CONTROLLERS_IRON void init(const std::string& params, std::shared_ptr handle); #else void init(const std::string& params, std::shared_ptr handle); @@ -73,7 +73,7 @@ class PDController double operator()(const double& error, const rclcpp::Duration& period); private: -#if defined CARTESIAN_CONTROLLERS_HUMBLE +#if defined CARTESIAN_CONTROLLERS_HUMBLE || defined CARTESIAN_CONTROLLERS_IRON std::shared_ptr m_handle; #else std::shared_ptr m_handle; ///< handle for dynamic parameter interaction diff --git a/cartesian_controller_base/include/cartesian_controller_base/ROS2VersionConfig.h.in b/cartesian_controller_base/include/cartesian_controller_base/ROS2VersionConfig.h.in index c1f4f38c..72ca4a31 100644 --- a/cartesian_controller_base/include/cartesian_controller_base/ROS2VersionConfig.h.in +++ b/cartesian_controller_base/include/cartesian_controller_base/ROS2VersionConfig.h.in @@ -4,3 +4,4 @@ #cmakedefine CARTESIAN_CONTROLLERS_FOXY #cmakedefine CARTESIAN_CONTROLLERS_GALACTIC #cmakedefine CARTESIAN_CONTROLLERS_HUMBLE +#cmakedefine CARTESIAN_CONTROLLERS_IRON \ No newline at end of file diff --git a/cartesian_controller_base/include/cartesian_controller_base/SelectivelyDampedLeastSquaresSolver.h b/cartesian_controller_base/include/cartesian_controller_base/SelectivelyDampedLeastSquaresSolver.h index 06d539e1..a89151f3 100644 --- a/cartesian_controller_base/include/cartesian_controller_base/SelectivelyDampedLeastSquaresSolver.h +++ b/cartesian_controller_base/include/cartesian_controller_base/SelectivelyDampedLeastSquaresSolver.h @@ -91,7 +91,7 @@ class SelectivelyDampedLeastSquaresSolver : public IKSolver * * \return True, if everything went well */ -#if defined CARTESIAN_CONTROLLERS_HUMBLE +#if defined CARTESIAN_CONTROLLERS_HUMBLE || defined CARTESIAN_CONTROLLERS_IRON bool init(std::shared_ptr nh, #else bool init(std::shared_ptr nh, diff --git a/cartesian_controller_base/include/cartesian_controller_base/SpatialPDController.h b/cartesian_controller_base/include/cartesian_controller_base/SpatialPDController.h index 177de8df..9713ea9c 100644 --- a/cartesian_controller_base/include/cartesian_controller_base/SpatialPDController.h +++ b/cartesian_controller_base/include/cartesian_controller_base/SpatialPDController.h @@ -58,7 +58,7 @@ class SpatialPDController public: SpatialPDController(); -#if defined CARTESIAN_CONTROLLERS_HUMBLE +#if defined CARTESIAN_CONTROLLERS_HUMBLE || defined CARTESIAN_CONTROLLERS_IRON bool init(std::shared_ptr params); #else bool init(std::shared_ptr params); diff --git a/cartesian_controller_base/include/cartesian_controller_base/cartesian_controller_base.h b/cartesian_controller_base/include/cartesian_controller_base/cartesian_controller_base.h index 6475d971..e72587d8 100644 --- a/cartesian_controller_base/include/cartesian_controller_base/cartesian_controller_base.h +++ b/cartesian_controller_base/include/cartesian_controller_base/cartesian_controller_base.h @@ -84,7 +84,7 @@ class CartesianControllerBase : public controller_interface::ControllerInterface virtual controller_interface::InterfaceConfiguration state_interface_configuration() const override; -#if defined CARTESIAN_CONTROLLERS_GALACTIC || defined CARTESIAN_CONTROLLERS_HUMBLE +#if defined CARTESIAN_CONTROLLERS_GALACTIC || defined CARTESIAN_CONTROLLERS_HUMBLE || defined CARTESIAN_CONTROLLERS_IRON virtual LifecycleNodeInterface::CallbackReturn on_init() override; #elif defined CARTESIAN_CONTROLLERS_FOXY virtual controller_interface::return_type init(const std::string & controller_name) override; diff --git a/cartesian_controller_base/src/DampedLeastSquaresSolver.cpp b/cartesian_controller_base/src/DampedLeastSquaresSolver.cpp index 729dd71f..7cccd6d1 100644 --- a/cartesian_controller_base/src/DampedLeastSquaresSolver.cpp +++ b/cartesian_controller_base/src/DampedLeastSquaresSolver.cpp @@ -116,7 +116,7 @@ namespace cartesian_controller_base{ return control_cmd; } -#if defined CARTESIAN_CONTROLLERS_HUMBLE +#if defined CARTESIAN_CONTROLLERS_HUMBLE || defined CARTESIAN_CONTROLLERS_IRON bool DampedLeastSquaresSolver::init(std::shared_ptr nh, #else bool DampedLeastSquaresSolver::init(std::shared_ptr nh, diff --git a/cartesian_controller_base/src/ForwardDynamicsSolver.cpp b/cartesian_controller_base/src/ForwardDynamicsSolver.cpp index 2092c032..21bc2cea 100644 --- a/cartesian_controller_base/src/ForwardDynamicsSolver.cpp +++ b/cartesian_controller_base/src/ForwardDynamicsSolver.cpp @@ -123,7 +123,7 @@ namespace cartesian_controller_base{ } -#if defined CARTESIAN_CONTROLLERS_HUMBLE +#if defined CARTESIAN_CONTROLLERS_HUMBLE || defined CARTESIAN_CONTROLLERS_IRON bool ForwardDynamicsSolver::init(std::shared_ptr nh, #else bool ForwardDynamicsSolver::init(std::shared_ptr nh, diff --git a/cartesian_controller_base/src/IKSolver.cpp b/cartesian_controller_base/src/IKSolver.cpp index 4ade1b75..77a0b4a7 100644 --- a/cartesian_controller_base/src/IKSolver.cpp +++ b/cartesian_controller_base/src/IKSolver.cpp @@ -115,7 +115,7 @@ namespace cartesian_controller_base{ } -#if defined CARTESIAN_CONTROLLERS_HUMBLE +#if defined CARTESIAN_CONTROLLERS_HUMBLE || defined CARTESIAN_CONTROLLERS_IRON bool IKSolver::init(std::shared_ptr /*nh*/, #else bool IKSolver::init(std::shared_ptr /*nh*/, diff --git a/cartesian_controller_base/src/JacobianTransposeSolver.cpp b/cartesian_controller_base/src/JacobianTransposeSolver.cpp index 937fa1b8..50c8d75c 100644 --- a/cartesian_controller_base/src/JacobianTransposeSolver.cpp +++ b/cartesian_controller_base/src/JacobianTransposeSolver.cpp @@ -106,7 +106,7 @@ namespace cartesian_controller_base{ return control_cmd; } -#if defined CARTESIAN_CONTROLLERS_HUMBLE +#if defined CARTESIAN_CONTROLLERS_HUMBLE || defined CARTESIAN_CONTROLLERS_IRON bool JacobianTransposeSolver::init(std::shared_ptr nh, #else bool JacobianTransposeSolver::init(std::shared_ptr nh, diff --git a/cartesian_controller_base/src/PDController.cpp b/cartesian_controller_base/src/PDController.cpp index dc8cabab..cdd1f2cc 100644 --- a/cartesian_controller_base/src/PDController.cpp +++ b/cartesian_controller_base/src/PDController.cpp @@ -54,7 +54,7 @@ PDController::~PDController() } -#if defined CARTESIAN_CONTROLLERS_HUMBLE +#if defined CARTESIAN_CONTROLLERS_HUMBLE || defined CARTESIAN_CONTROLLERS_IRON void PDController::init(const std::string& params, std::shared_ptr handle) #else void PDController::init(const std::string& params, std::shared_ptr handle) diff --git a/cartesian_controller_base/src/SelectivelyDampedLeastSquaresSolver.cpp b/cartesian_controller_base/src/SelectivelyDampedLeastSquaresSolver.cpp index d93ac8fa..b338f846 100644 --- a/cartesian_controller_base/src/SelectivelyDampedLeastSquaresSolver.cpp +++ b/cartesian_controller_base/src/SelectivelyDampedLeastSquaresSolver.cpp @@ -139,7 +139,7 @@ namespace cartesian_controller_base{ return control_cmd; } -#if defined CARTESIAN_CONTROLLERS_HUMBLE +#if defined CARTESIAN_CONTROLLERS_HUMBLE || defined CARTESIAN_CONTROLLERS_IRON bool SelectivelyDampedLeastSquaresSolver::init(std::shared_ptr nh, #else bool SelectivelyDampedLeastSquaresSolver::init(std::shared_ptr nh, diff --git a/cartesian_controller_base/src/SpatialPDController.cpp b/cartesian_controller_base/src/SpatialPDController.cpp index 89cef9c5..479bba04 100644 --- a/cartesian_controller_base/src/SpatialPDController.cpp +++ b/cartesian_controller_base/src/SpatialPDController.cpp @@ -57,7 +57,7 @@ ctrl::Vector6D SpatialPDController::operator()(const ctrl::Vector6D& error, cons return m_cmd; } -#if defined CARTESIAN_CONTROLLERS_HUMBLE +#if defined CARTESIAN_CONTROLLERS_HUMBLE || defined CARTESIAN_CONTROLLERS_IRON bool SpatialPDController::init(std::shared_ptr handle) #else bool SpatialPDController::init(std::shared_ptr handle) diff --git a/cartesian_controller_base/src/cartesian_controller_base.cpp b/cartesian_controller_base/src/cartesian_controller_base.cpp index 89474614..aad4749e 100644 --- a/cartesian_controller_base/src/cartesian_controller_base.cpp +++ b/cartesian_controller_base/src/cartesian_controller_base.cpp @@ -85,7 +85,7 @@ controller_interface::InterfaceConfiguration CartesianControllerBase::state_inte return conf; } -#if defined CARTESIAN_CONTROLLERS_GALACTIC || defined CARTESIAN_CONTROLLERS_HUMBLE +#if defined CARTESIAN_CONTROLLERS_GALACTIC || defined CARTESIAN_CONTROLLERS_HUMBLE || defined CARTESIAN_CONTROLLERS_IRON rclcpp_lifecycle::node_interfaces::LifecycleNodeInterface::CallbackReturn CartesianControllerBase::on_init() { if (!m_initialized) @@ -390,7 +390,7 @@ void CartesianControllerBase::writeJointControlCmds() RCLCPP_ERROR(get_node()->get_logger(), "NaN detected in internal model. It's unlikely to recover from this. Shutting down."); -#if defined CARTESIAN_CONTROLLERS_HUMBLE +#if defined CARTESIAN_CONTROLLERS_HUMBLE || defined CARTESIAN_CONTROLLERS_IRON get_node()->shutdown(); #elif defined CARTESIAN_CONTROLLERS_FOXY || defined CARTESIAN_CONTROLLERS_GALACTIC this->shutdown(); diff --git a/cartesian_force_controller/include/cartesian_force_controller/cartesian_force_controller.h b/cartesian_force_controller/include/cartesian_force_controller/cartesian_force_controller.h index 8d3f83e3..a7a589f7 100644 --- a/cartesian_force_controller/include/cartesian_force_controller/cartesian_force_controller.h +++ b/cartesian_force_controller/include/cartesian_force_controller/cartesian_force_controller.h @@ -75,7 +75,7 @@ class CartesianForceController : public virtual cartesian_controller_base::Carte public: CartesianForceController(); -#if defined CARTESIAN_CONTROLLERS_GALACTIC || defined CARTESIAN_CONTROLLERS_HUMBLE +#if defined CARTESIAN_CONTROLLERS_GALACTIC || defined CARTESIAN_CONTROLLERS_HUMBLE || defined CARTESIAN_CONTROLLERS_IRON virtual LifecycleNodeInterface::CallbackReturn on_init() override; #elif defined CARTESIAN_CONTROLLERS_FOXY virtual controller_interface::return_type init(const std::string & controller_name) override; @@ -90,7 +90,7 @@ class CartesianForceController : public virtual cartesian_controller_base::Carte rclcpp_lifecycle::node_interfaces::LifecycleNodeInterface::CallbackReturn on_deactivate( const rclcpp_lifecycle::State & previous_state) override; -#if defined CARTESIAN_CONTROLLERS_GALACTIC || defined CARTESIAN_CONTROLLERS_HUMBLE +#if defined CARTESIAN_CONTROLLERS_GALACTIC || defined CARTESIAN_CONTROLLERS_HUMBLE || defined CARTESIAN_CONTROLLERS_IRON controller_interface::return_type update(const rclcpp::Time & time, const rclcpp::Duration & period) override; #elif defined CARTESIAN_CONTROLLERS_FOXY controller_interface::return_type update() override; diff --git a/cartesian_force_controller/src/cartesian_force_controller.cpp b/cartesian_force_controller/src/cartesian_force_controller.cpp index fe0fcd37..954ce82c 100644 --- a/cartesian_force_controller/src/cartesian_force_controller.cpp +++ b/cartesian_force_controller/src/cartesian_force_controller.cpp @@ -50,7 +50,7 @@ CartesianForceController::CartesianForceController() { } -#if defined CARTESIAN_CONTROLLERS_GALACTIC || defined CARTESIAN_CONTROLLERS_HUMBLE +#if defined CARTESIAN_CONTROLLERS_GALACTIC || defined CARTESIAN_CONTROLLERS_HUMBLE || defined CARTESIAN_CONTROLLERS_IRON rclcpp_lifecycle::node_interfaces::LifecycleNodeInterface::CallbackReturn CartesianForceController::on_init() { const auto ret = Base::on_init(); @@ -134,7 +134,7 @@ rclcpp_lifecycle::node_interfaces::LifecycleNodeInterface::CallbackReturn Cartes return rclcpp_lifecycle::node_interfaces::LifecycleNodeInterface::CallbackReturn::SUCCESS; } -#if defined CARTESIAN_CONTROLLERS_GALACTIC || defined CARTESIAN_CONTROLLERS_HUMBLE +#if defined CARTESIAN_CONTROLLERS_GALACTIC || defined CARTESIAN_CONTROLLERS_HUMBLE || defined CARTESIAN_CONTROLLERS_IRON controller_interface::return_type CartesianForceController::update(const rclcpp::Time& time, const rclcpp::Duration& period) #elif defined CARTESIAN_CONTROLLERS_FOXY @@ -176,7 +176,7 @@ ctrl::Vector6D CartesianForceController::computeForceError() } // Superimpose target wrench and sensor wrench in base frame -#if defined CARTESIAN_CONTROLLERS_GALACTIC || defined CARTESIAN_CONTROLLERS_HUMBLE +#if defined CARTESIAN_CONTROLLERS_GALACTIC || defined CARTESIAN_CONTROLLERS_HUMBLE || defined CARTESIAN_CONTROLLERS_IRON return Base::displayInBaseLink(m_ft_sensor_wrench,m_new_ft_sensor_ref) + target_wrench; #elif defined CARTESIAN_CONTROLLERS_FOXY return m_ft_sensor_wrench + target_wrench; @@ -245,7 +245,7 @@ void CartesianForceController::ftSensorWrenchCallback(const geometry_msgs::msg:: } -#if defined CARTESIAN_CONTROLLERS_GALACTIC || defined CARTESIAN_CONTROLLERS_HUMBLE +#if defined CARTESIAN_CONTROLLERS_GALACTIC || defined CARTESIAN_CONTROLLERS_HUMBLE || defined CARTESIAN_CONTROLLERS_IRON KDL::Wrench tmp; tmp[0] = wrench->wrench.force.x; tmp[1] = wrench->wrench.force.y; diff --git a/cartesian_motion_controller/include/cartesian_motion_controller/cartesian_motion_controller.h b/cartesian_motion_controller/include/cartesian_motion_controller/cartesian_motion_controller.h index 244c3489..1c409e2d 100644 --- a/cartesian_motion_controller/include/cartesian_motion_controller/cartesian_motion_controller.h +++ b/cartesian_motion_controller/include/cartesian_motion_controller/cartesian_motion_controller.h @@ -76,7 +76,7 @@ class CartesianMotionController : public virtual cartesian_controller_base::Cart CartesianMotionController(); virtual ~CartesianMotionController() = default; -#if defined CARTESIAN_CONTROLLERS_GALACTIC || defined CARTESIAN_CONTROLLERS_HUMBLE +#if defined CARTESIAN_CONTROLLERS_GALACTIC || defined CARTESIAN_CONTROLLERS_HUMBLE || defined CARTESIAN_CONTROLLERS_IRON virtual LifecycleNodeInterface::CallbackReturn on_init() override; #elif defined CARTESIAN_CONTROLLERS_FOXY virtual controller_interface::return_type init(const std::string & controller_name) override; @@ -91,7 +91,7 @@ class CartesianMotionController : public virtual cartesian_controller_base::Cart rclcpp_lifecycle::node_interfaces::LifecycleNodeInterface::CallbackReturn on_deactivate( const rclcpp_lifecycle::State & previous_state) override; -#if defined CARTESIAN_CONTROLLERS_GALACTIC || defined CARTESIAN_CONTROLLERS_HUMBLE +#if defined CARTESIAN_CONTROLLERS_GALACTIC || defined CARTESIAN_CONTROLLERS_HUMBLE || defined CARTESIAN_CONTROLLERS_IRON controller_interface::return_type update(const rclcpp::Time & time, const rclcpp::Duration & period) override; #elif defined CARTESIAN_CONTROLLERS_FOXY controller_interface::return_type update() override; diff --git a/cartesian_motion_controller/src/cartesian_motion_controller.cpp b/cartesian_motion_controller/src/cartesian_motion_controller.cpp index 4c7b6f76..359152e4 100644 --- a/cartesian_motion_controller/src/cartesian_motion_controller.cpp +++ b/cartesian_motion_controller/src/cartesian_motion_controller.cpp @@ -53,7 +53,7 @@ CartesianMotionController::CartesianMotionController() { } -#if defined CARTESIAN_CONTROLLERS_GALACTIC || defined CARTESIAN_CONTROLLERS_HUMBLE +#if defined CARTESIAN_CONTROLLERS_GALACTIC || defined CARTESIAN_CONTROLLERS_HUMBLE || defined CARTESIAN_CONTROLLERS_IRON rclcpp_lifecycle::node_interfaces::LifecycleNodeInterface::CallbackReturn CartesianMotionController::on_init() { const auto ret = Base::on_init(); @@ -114,7 +114,7 @@ rclcpp_lifecycle::node_interfaces::LifecycleNodeInterface::CallbackReturn Cartes return rclcpp_lifecycle::node_interfaces::LifecycleNodeInterface::CallbackReturn::SUCCESS; } -#if defined CARTESIAN_CONTROLLERS_GALACTIC || defined CARTESIAN_CONTROLLERS_HUMBLE +#if defined CARTESIAN_CONTROLLERS_GALACTIC || defined CARTESIAN_CONTROLLERS_HUMBLE || defined CARTESIAN_CONTROLLERS_IRON controller_interface::return_type CartesianMotionController::update(const rclcpp::Time& time, const rclcpp::Duration& period) #elif defined CARTESIAN_CONTROLLERS_FOXY From 6b86e79cada1d9d14f92e6377aabf2c410c1318f Mon Sep 17 00:00:00 2001 From: Stefan Scherzinger Date: Thu, 13 Jul 2023 15:18:29 +0200 Subject: [PATCH 6/9] Activate CI for ROS2 Iron --- .../workflows/industrial_ci_iron_action.yml | 20 +++++++++++++++++++ README.md | 1 + 2 files changed, 21 insertions(+) create mode 100644 .github/workflows/industrial_ci_iron_action.yml diff --git a/.github/workflows/industrial_ci_iron_action.yml b/.github/workflows/industrial_ci_iron_action.yml new file mode 100644 index 00000000..548b2efc --- /dev/null +++ b/.github/workflows/industrial_ci_iron_action.yml @@ -0,0 +1,20 @@ +name: Iron + +on: [push, pull_request] + + +jobs: + industrial_ci: + env: + BEFORE_BUILD_TARGET_WORKSPACE: '.github/script/install_mujoco.sh' + strategy: + fail-fast: false + matrix: + env: + - {ROS_DISTRO: iron, ROS_REPO: testing} + - {ROS_DISTRO: iron, ROS_REPO: main} + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v1 + - uses: 'ros-industrial/industrial_ci@master' + env: ${{matrix.env}} diff --git a/README.md b/README.md index 0f90e1f2..358802e3 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,7 @@ ![build badge](https://github.com/fzi-forschungszentrum-informatik/cartesian_controllers/actions/workflows/industrial_ci_foxy_action.yml/badge.svg) ![build badge](https://github.com/fzi-forschungszentrum-informatik/cartesian_controllers/actions/workflows/industrial_ci_galactic_action.yml/badge.svg) ![build badge](https://github.com/fzi-forschungszentrum-informatik/cartesian_controllers/actions/workflows/industrial_ci_humble_action.yml/badge.svg) +![build badge](https://github.com/fzi-forschungszentrum-informatik/cartesian_controllers/actions/workflows/industrial_ci_iron_action.yml/badge.svg) [![License](https://img.shields.io/badge/License-BSD_3--Clause-blue.svg)](https://opensource.org/licenses/BSD-3-Clause) --- From 951e4f29c8e526dc39b0b4e0e3bbaf7a1978a89d Mon Sep 17 00:00:00 2001 From: Stefan Scherzinger Date: Thu, 13 Jul 2023 15:20:23 +0200 Subject: [PATCH 7/9] Update CMake warning for unsupported ROS2 version --- cartesian_controller_base/CMakeLists.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cartesian_controller_base/CMakeLists.txt b/cartesian_controller_base/CMakeLists.txt index 0989db1f..21f49074 100644 --- a/cartesian_controller_base/CMakeLists.txt +++ b/cartesian_controller_base/CMakeLists.txt @@ -7,7 +7,7 @@ set(ADDITIONAL_COMPILE_OPTIONS -Wall -Wextra -Wpedantic -Wno-unused-parameter) add_compile_options(${ADDITIONAL_COMPILE_OPTIONS}) # Use CMake to pass the current ROS_DISTRO via variables into a preprocessor template. -# We then include this file and switch between the API for foxy and galactic. +# We then include this file and switch between the different APIs. if($ENV{ROS_DISTRO} STREQUAL "iron") set(CARTESIAN_CONTROLLERS_IRON TRUE) elseif($ENV{ROS_DISTRO} STREQUAL "humble") @@ -17,7 +17,7 @@ elseif($ENV{ROS_DISTRO} STREQUAL "galactic") elseif($ENV{ROS_DISTRO} STREQUAL "foxy") set(CARTESIAN_CONTROLLERS_FOXY TRUE) else() - message(WARNING "ROS2 version must be {foxy|galactic|humble}") + message(WARNING "ROS2 version must be {iron|humble|galactic|foxy}") endif() configure_file(include/cartesian_controller_base/ROS2VersionConfig.h.in ROS2VersionConfig.h) From bc3f358782764f3aa56ef2567dcc0b4bbaa93127 Mon Sep 17 00:00:00 2001 From: Stefan Scherzinger Date: Thu, 13 Jul 2023 15:52:27 +0200 Subject: [PATCH 8/9] Port motion control handles and simulation to Iron --- .../motion_control_handle.h | 4 ++-- .../src/motion_control_handle.cpp | 6 +++--- .../system_interface.h | 6 +++--- .../launch/simulation.launch.py | 2 +- .../src/system_interface.cpp | 16 ++++++++-------- .../integration_tests/integration_tests.py | 2 +- 6 files changed, 18 insertions(+), 18 deletions(-) diff --git a/cartesian_controller_handles/include/cartesian_controller_handles/motion_control_handle.h b/cartesian_controller_handles/include/cartesian_controller_handles/motion_control_handle.h index 223d93bb..6f27116f 100644 --- a/cartesian_controller_handles/include/cartesian_controller_handles/motion_control_handle.h +++ b/cartesian_controller_handles/include/cartesian_controller_handles/motion_control_handle.h @@ -75,7 +75,7 @@ class MotionControlHandle : public controller_interface::ControllerInterface MotionControlHandle(); ~MotionControlHandle(); -#if defined CARTESIAN_CONTROLLERS_GALACTIC || defined CARTESIAN_CONTROLLERS_HUMBLE +#if defined CARTESIAN_CONTROLLERS_GALACTIC || defined CARTESIAN_CONTROLLERS_HUMBLE || defined CARTESIAN_CONTROLLERS_IRON virtual LifecycleNodeInterface::CallbackReturn on_init() override; #elif defined CARTESIAN_CONTROLLERS_FOXY virtual controller_interface::return_type init(const std::string & controller_name) override; @@ -93,7 +93,7 @@ class MotionControlHandle : public controller_interface::ControllerInterface controller_interface::InterfaceConfiguration command_interface_configuration() const override; controller_interface::InterfaceConfiguration state_interface_configuration() const override; -#if defined CARTESIAN_CONTROLLERS_GALACTIC || defined CARTESIAN_CONTROLLERS_HUMBLE +#if defined CARTESIAN_CONTROLLERS_GALACTIC || defined CARTESIAN_CONTROLLERS_HUMBLE || defined CARTESIAN_CONTROLLERS_IRON controller_interface::return_type update(const rclcpp::Time & time, const rclcpp::Duration & period) override; #elif defined CARTESIAN_CONTROLLERS_FOXY controller_interface::return_type update() override; diff --git a/cartesian_controller_handles/src/motion_control_handle.cpp b/cartesian_controller_handles/src/motion_control_handle.cpp index ae571b05..b8a2c28a 100644 --- a/cartesian_controller_handles/src/motion_control_handle.cpp +++ b/cartesian_controller_handles/src/motion_control_handle.cpp @@ -83,7 +83,7 @@ MotionControlHandle::on_deactivate(const rclcpp_lifecycle::State& previous_state return rclcpp_lifecycle::node_interfaces::LifecycleNodeInterface::CallbackReturn::SUCCESS; } -#if defined CARTESIAN_CONTROLLERS_GALACTIC || defined CARTESIAN_CONTROLLERS_HUMBLE +#if defined CARTESIAN_CONTROLLERS_GALACTIC || defined CARTESIAN_CONTROLLERS_HUMBLE || defined CARTESIAN_CONTROLLERS_IRON controller_interface::return_type MotionControlHandle::update(const rclcpp::Time& time, const rclcpp::Duration& period) #elif defined CARTESIAN_CONTROLLERS_FOXY @@ -121,7 +121,7 @@ MotionControlHandle::state_interface_configuration() const } -#if defined CARTESIAN_CONTROLLERS_GALACTIC || defined CARTESIAN_CONTROLLERS_HUMBLE +#if defined CARTESIAN_CONTROLLERS_GALACTIC || defined CARTESIAN_CONTROLLERS_HUMBLE || defined CARTESIAN_CONTROLLERS_IRON rclcpp_lifecycle::node_interfaces::LifecycleNodeInterface::CallbackReturn MotionControlHandle::on_init() { @@ -141,7 +141,7 @@ controller_interface::return_type MotionControlHandle::init(const std::string& c auto_declare("end_effector_link", ""); auto_declare >("joints", std::vector()); -#if defined CARTESIAN_CONTROLLERS_GALACTIC || defined CARTESIAN_CONTROLLERS_HUMBLE +#if defined CARTESIAN_CONTROLLERS_GALACTIC || defined CARTESIAN_CONTROLLERS_HUMBLE || defined CARTESIAN_CONTROLLERS_IRON return rclcpp_lifecycle::node_interfaces::LifecycleNodeInterface::CallbackReturn::SUCCESS; #elif defined CARTESIAN_CONTROLLERS_FOXY return controller_interface::return_type::OK; diff --git a/cartesian_controller_simulation/include/cartesian_controller_simulation/system_interface.h b/cartesian_controller_simulation/include/cartesian_controller_simulation/system_interface.h index ae1bc1f4..b4972f05 100644 --- a/cartesian_controller_simulation/include/cartesian_controller_simulation/system_interface.h +++ b/cartesian_controller_simulation/include/cartesian_controller_simulation/system_interface.h @@ -71,7 +71,7 @@ constexpr char HW_IF_DAMPING[] = "damping"; * controller_manager coordinated library. * */ -#if defined CARTESIAN_CONTROLLERS_GALACTIC || defined CARTESIAN_CONTROLLERS_HUMBLE +#if defined CARTESIAN_CONTROLLERS_GALACTIC || defined CARTESIAN_CONTROLLERS_HUMBLE || defined CARTESIAN_CONTROLLERS_IRON class Simulator : public hardware_interface::SystemInterface #elif defined CARTESIAN_CONTROLLERS_FOXY class Simulator : public hardware_interface::BaseInterface @@ -83,7 +83,7 @@ class Simulator : public hardware_interface::BaseInterface& stop_interfaces) override; -#if defined CARTESIAN_CONTROLLERS_HUMBLE +#if defined CARTESIAN_CONTROLLERS_HUMBLE || defined CARTESIAN_CONTROLLERS_IRON return_type read(const rclcpp::Time& time, const rclcpp::Duration& period) override; return_type write(const rclcpp::Time& time, const rclcpp::Duration& period) override; diff --git a/cartesian_controller_simulation/launch/simulation.launch.py b/cartesian_controller_simulation/launch/simulation.launch.py index 1a95133e..d225faf5 100644 --- a/cartesian_controller_simulation/launch/simulation.launch.py +++ b/cartesian_controller_simulation/launch/simulation.launch.py @@ -45,7 +45,7 @@ import os distro = os.environ['ROS_DISTRO'] -if distro == 'humble' or distro == 'galactic': +if distro == 'iron' or distro == 'humble' or distro == 'galactic': spawner = "spawner" else: # foxy spawner = "spawner.py" diff --git a/cartesian_controller_simulation/src/system_interface.cpp b/cartesian_controller_simulation/src/system_interface.cpp index 3b055e78..ca92d7bd 100644 --- a/cartesian_controller_simulation/src/system_interface.cpp +++ b/cartesian_controller_simulation/src/system_interface.cpp @@ -57,7 +57,7 @@ namespace cartesian_controller_simulation { -#if defined CARTESIAN_CONTROLLERS_GALACTIC || defined CARTESIAN_CONTROLLERS_HUMBLE +#if defined CARTESIAN_CONTROLLERS_GALACTIC || defined CARTESIAN_CONTROLLERS_HUMBLE || defined CARTESIAN_CONTROLLERS_IRON Simulator::CallbackReturn Simulator::on_init(const hardware_interface::HardwareInfo& info) { // Keep an internal copy of the given configuration @@ -105,7 +105,7 @@ Simulator::return_type Simulator::configure(const hardware_interface::HardwareIn RCLCPP_ERROR(rclcpp::get_logger("Simulator"), "Joint '%s' needs two possible command interfaces.", joint.name.c_str()); -#if defined CARTESIAN_CONTROLLERS_GALACTIC || defined CARTESIAN_CONTROLLERS_HUMBLE +#if defined CARTESIAN_CONTROLLERS_GALACTIC || defined CARTESIAN_CONTROLLERS_HUMBLE || defined CARTESIAN_CONTROLLERS_IRON return Simulator::CallbackReturn::ERROR; #elif defined CARTESIAN_CONTROLLERS_FOXY return Simulator::return_type::ERROR; @@ -120,7 +120,7 @@ Simulator::return_type Simulator::configure(const hardware_interface::HardwareIn joint.name.c_str(), hardware_interface::HW_IF_POSITION, hardware_interface::HW_IF_VELOCITY); -#if defined CARTESIAN_CONTROLLERS_GALACTIC || defined CARTESIAN_CONTROLLERS_HUMBLE +#if defined CARTESIAN_CONTROLLERS_GALACTIC || defined CARTESIAN_CONTROLLERS_HUMBLE || defined CARTESIAN_CONTROLLERS_IRON return Simulator::CallbackReturn::ERROR; #elif defined CARTESIAN_CONTROLLERS_FOXY return Simulator::return_type::ERROR; @@ -132,7 +132,7 @@ Simulator::return_type Simulator::configure(const hardware_interface::HardwareIn RCLCPP_ERROR(rclcpp::get_logger("Simulator"), "Joint '%s' needs 3 state interfaces.", joint.name.c_str()); -#if defined CARTESIAN_CONTROLLERS_GALACTIC || defined CARTESIAN_CONTROLLERS_HUMBLE +#if defined CARTESIAN_CONTROLLERS_GALACTIC || defined CARTESIAN_CONTROLLERS_HUMBLE || defined CARTESIAN_CONTROLLERS_IRON return Simulator::CallbackReturn::ERROR; #elif defined CARTESIAN_CONTROLLERS_FOXY return Simulator::return_type::ERROR; @@ -149,7 +149,7 @@ Simulator::return_type Simulator::configure(const hardware_interface::HardwareIn hardware_interface::HW_IF_POSITION, hardware_interface::HW_IF_VELOCITY, hardware_interface::HW_IF_EFFORT); -#if defined CARTESIAN_CONTROLLERS_GALACTIC || defined CARTESIAN_CONTROLLERS_HUMBLE +#if defined CARTESIAN_CONTROLLERS_GALACTIC || defined CARTESIAN_CONTROLLERS_HUMBLE || defined CARTESIAN_CONTROLLERS_IRON return Simulator::CallbackReturn::ERROR; #elif defined CARTESIAN_CONTROLLERS_FOXY return Simulator::return_type::ERROR; @@ -157,7 +157,7 @@ Simulator::return_type Simulator::configure(const hardware_interface::HardwareIn } } -#if defined CARTESIAN_CONTROLLERS_GALACTIC || defined CARTESIAN_CONTROLLERS_HUMBLE +#if defined CARTESIAN_CONTROLLERS_GALACTIC || defined CARTESIAN_CONTROLLERS_HUMBLE || defined CARTESIAN_CONTROLLERS_IRON return Simulator::CallbackReturn::SUCCESS; #elif defined CARTESIAN_CONTROLLERS_FOXY return Simulator::return_type::OK; @@ -222,7 +222,7 @@ Simulator::return_type Simulator::stop() #endif -#if defined CARTESIAN_CONTROLLERS_HUMBLE +#if defined CARTESIAN_CONTROLLERS_HUMBLE || defined CARTESIAN_CONTROLLERS_IRON Simulator::return_type Simulator::read([[maybe_unused]] const rclcpp::Time& time, [[maybe_unused]] const rclcpp::Duration& period) #elif defined CARTESIAN_CONTROLLERS_GALACTIC || defined CARTESIAN_CONTROLLERS_FOXY @@ -249,7 +249,7 @@ Simulator::return_type Simulator::read() return return_type::OK; } -#if defined CARTESIAN_CONTROLLERS_HUMBLE +#if defined CARTESIAN_CONTROLLERS_HUMBLE || defined CARTESIAN_CONTROLLERS_IRON Simulator::return_type Simulator::write([[maybe_unused]] const rclcpp::Time& time, [[maybe_unused]] const rclcpp::Duration& period) #elif defined CARTESIAN_CONTROLLERS_GALACTIC || defined CARTESIAN_CONTROLLERS_FOXY diff --git a/cartesian_controller_tests/integration_tests/integration_tests.py b/cartesian_controller_tests/integration_tests/integration_tests.py index 6a4122ef..fa14caee 100755 --- a/cartesian_controller_tests/integration_tests/integration_tests.py +++ b/cartesian_controller_tests/integration_tests/integration_tests.py @@ -96,7 +96,7 @@ def test_invalid_controller_initialization(self): controller manager contains our controllers and if they have the expected state. """ - if os.environ['ROS_DISTRO'] == 'humble': + if os.environ['ROS_DISTRO'] == 'humble' or os.environ['ROS_DISTRO'] == 'iron': expected_state = 'unconfigured' else: # galactic, foxy expected_state = 'finalized' From 03057bde4e1b04ff59e9bc1393f3fb47db2548e2 Mon Sep 17 00:00:00 2001 From: Stefan Scherzinger Date: Thu, 21 Sep 2023 17:52:49 +0200 Subject: [PATCH 9/9] Fix launch scripts for Iron We need a distinction between *humble*, *iron*, and the other versions at several places. Also use a convenience function for constructing the many spawners. --- .../launch/simulation.launch.py | 90 ++++++++----------- .../integration_tests/integration_tests.py | 13 ++- 2 files changed, 46 insertions(+), 57 deletions(-) diff --git a/cartesian_controller_simulation/launch/simulation.launch.py b/cartesian_controller_simulation/launch/simulation.launch.py index d225faf5..9919aee6 100644 --- a/cartesian_controller_simulation/launch/simulation.launch.py +++ b/cartesian_controller_simulation/launch/simulation.launch.py @@ -45,7 +45,7 @@ import os distro = os.environ['ROS_DISTRO'] -if distro == 'iron' or distro == 'humble' or distro == 'galactic': +if distro in ['galactic', 'humble', 'iron']: spawner = "spawner" else: # foxy spawner = "spawner.py" @@ -98,47 +98,35 @@ def generate_launch_description(): ] ) - # Joint states - joint_state_broadcaster_spawner = Node( - package="controller_manager", - executable=spawner, - arguments=["joint_state_broadcaster", "-c", "/controller_manager"], - ) - cartesian_compliance_controller_spawner = Node( - package="controller_manager", - executable=spawner, - arguments=["cartesian_compliance_controller", "--stopped", "-c", "/controller_manager"], - ) - cartesian_force_controller_spawner = Node( - package="controller_manager", - executable=spawner, - arguments=["cartesian_force_controller", "--stopped", "-c", "/controller_manager"], - ) - cartesian_motion_controller_spawner = Node( - package="controller_manager", - executable=spawner, - arguments=["cartesian_motion_controller", "--stopped", "-c", "/controller_manager"], - ) - motion_control_handle_spawner = Node( - package="controller_manager", - executable=spawner, - arguments=["motion_control_handle", "--stopped", "-c", "/controller_manager"], - ) - joint_trajectory_controller_spawner = Node( - package="controller_manager", - executable=spawner, - arguments=["joint_trajectory_controller", "--stopped", "-c", "/controller_manager"], - ) - invalid_cartesian_compliance_controller_spawner = Node( - package="controller_manager", - executable=spawner, - arguments=["invalid_cartesian_compliance_controller", "--stopped", "-c", "/controller_manager"], - ) - invalid_cartesian_force_controller_spawner = Node( - package="controller_manager", - executable=spawner, - arguments=["invalid_cartesian_force_controller", "--stopped", "-c", "/controller_manager"], - ) + # Convenience function for easy spawner construction + def controller_spawner(name, *args): + return Node( + package="controller_manager", + executable=spawner, + output="screen", + arguments=[name] + [a for a in args], + ) + + # Active controllers + active_list = [ + "joint_state_broadcaster", + ] + active_spawners = [controller_spawner(controller) for controller in active_list] + + # Inactive controllers + inactive_list = [ + "cartesian_compliance_controller", + "cartesian_force_controller", + "cartesian_motion_controller", + "motion_control_handle", + "joint_trajectory_controller", + "invalid_cartesian_compliance_controller", + "invalid_cartesian_force_controller", + ] + state = "--inactive" if distro in ['humble', 'iron'] else "--stopped" + inactive_spawners = [ + controller_spawner(controller, state) for controller in inactive_list + ] # TF tree robot_state_publisher = Node( @@ -161,18 +149,10 @@ def generate_launch_description(): ) # Nodes to start - nodes = [ - control_node, - joint_state_broadcaster_spawner, - cartesian_compliance_controller_spawner, - cartesian_force_controller_spawner, - cartesian_motion_controller_spawner, - motion_control_handle_spawner, - joint_trajectory_controller_spawner, - invalid_cartesian_compliance_controller_spawner, - invalid_cartesian_force_controller_spawner, - robot_state_publisher, - rviz - ] + nodes = ( + [control_node, robot_state_publisher, rviz] + + active_spawners + + inactive_spawners + ) return LaunchDescription(declared_arguments + nodes) diff --git a/cartesian_controller_tests/integration_tests/integration_tests.py b/cartesian_controller_tests/integration_tests/integration_tests.py index fa14caee..829682a1 100755 --- a/cartesian_controller_tests/integration_tests/integration_tests.py +++ b/cartesian_controller_tests/integration_tests/integration_tests.py @@ -18,6 +18,9 @@ from geometry_msgs.msg import PoseStamped from geometry_msgs.msg import WrenchStamped +import os + +distro = os.environ['ROS_DISTRO'] def generate_test_description(): @@ -181,13 +184,19 @@ def check_state(self, controller, state): def start_controller(self, controller): """ Start the given controller """ req = SwitchController.Request() - req.start_controllers = [controller] + if distro in ['humble', 'iron']: + req.activate_controllers = [controller] + else: + req.start_controllers = [controller] self.perform_switch(req) def stop_controller(self, controller): """ Stop the given controller """ req = SwitchController.Request() - req.stop_controllers = [controller] + if distro in ['humble', 'iron']: + req.deactivate_controllers = [controller] + else: + req.stop_controllers = [controller] self.perform_switch(req) def perform_switch(self, req):