From 44c5a6fce0e1efd0482be00f8372a58442462117 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=81ron=20Svastits?= <49677296+Svastits@users.noreply.github.com> Date: Mon, 22 Apr 2024 14:52:45 +0200 Subject: [PATCH] Adapt to REP-144 (#160) * package name fixes * rename files and dirs --------- Co-authored-by: Aron Svastits --- .../control_mode_handler/visibility_control.h | 49 ------------------- .../event_broadcaster/visibility_control.h | 49 ------------------- .../CMakeLists.txt | 6 +-- .../controller_plugins.xml | 2 +- .../kuka_control_mode_handler.hpp} | 22 ++++----- .../visibility_control.h | 49 +++++++++++++++++++ .../package.xml | 2 +- .../src/kuka_control_mode_handler.cpp} | 2 +- controllers/kuka_controllers/package.xml | 4 +- .../CMakeLists.txt | 6 +-- .../controller_plugins.xml | 2 +- .../kuka_event_broadcaster.hpp} | 22 ++++----- .../visibility_control.h | 49 +++++++++++++++++++ .../package.xml | 2 +- .../src/kuka_event_broadcaster.cpp} | 2 +- doc/wiki/1_iiQKA_EAC.md | 2 +- doc/wiki/4_Controllers.md | 4 +- kuka_iiqka_eac_driver/package.xml | 4 +- .../src/robot_manager_node.cpp | 6 +-- sonar-project.properties | 2 +- 20 files changed, 143 insertions(+), 143 deletions(-) delete mode 100644 controllers/control_mode_handler/include/control_mode_handler/visibility_control.h delete mode 100644 controllers/event_broadcaster/include/event_broadcaster/visibility_control.h rename controllers/{control_mode_handler => kuka_control_mode_handler}/CMakeLists.txt (88%) rename controllers/{control_mode_handler => kuka_control_mode_handler}/controller_plugins.xml (86%) rename controllers/{control_mode_handler/include/control_mode_handler/control_mode_handler.hpp => kuka_control_mode_handler/include/kuka_control_mode_handler/kuka_control_mode_handler.hpp} (65%) create mode 100644 controllers/kuka_control_mode_handler/include/kuka_control_mode_handler/visibility_control.h rename controllers/{control_mode_handler => kuka_control_mode_handler}/package.xml (93%) rename controllers/{control_mode_handler/src/control_mode_handler.cpp => kuka_control_mode_handler/src/kuka_control_mode_handler.cpp} (97%) rename controllers/{event_broadcaster => kuka_event_broadcaster}/CMakeLists.txt (89%) rename controllers/{event_broadcaster => kuka_event_broadcaster}/controller_plugins.xml (87%) rename controllers/{event_broadcaster/include/event_broadcaster/event_broadcaster.hpp => kuka_event_broadcaster/include/kuka_event_broadcaster/kuka_event_broadcaster.hpp} (65%) create mode 100644 controllers/kuka_event_broadcaster/include/kuka_event_broadcaster/visibility_control.h rename controllers/{event_broadcaster => kuka_event_broadcaster}/package.xml (94%) rename controllers/{event_broadcaster/src/event_broadcaster.cpp => kuka_event_broadcaster/src/kuka_event_broadcaster.cpp} (97%) diff --git a/controllers/control_mode_handler/include/control_mode_handler/visibility_control.h b/controllers/control_mode_handler/include/control_mode_handler/visibility_control.h deleted file mode 100644 index 2db1ce12..00000000 --- a/controllers/control_mode_handler/include/control_mode_handler/visibility_control.h +++ /dev/null @@ -1,49 +0,0 @@ -// Copyright 2023 Aron Svastits -// -// 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 -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// 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. - -#ifndef CONTROL_MODE_HANDLER__VISIBILITY_CONTROL_H_ -#define CONTROL_MODE_HANDLER__VISIBILITY_CONTROL_H_ - -// This logic was borrowed (then namespaced) from the examples on the gcc wiki: -// https://gcc.gnu.org/wiki/Visibility - -#if defined _WIN32 || defined __CYGWIN__ -#ifdef __GNUC__ -#define CONTROL_MODE_HANDLER_EXPORT __attribute__((dllexport)) -#define CONTROL_MODE_HANDLER_IMPORT __attribute__((dllimport)) -#else -#define CONTROL_MODE_HANDLER_EXPORT __declspec(dllexport) -#define CONTROL_MODE_HANDLER_IMPORT __declspec(dllimport) -#endif -#ifdef CONTROL_MODE_HANDLER_BUILDING_LIBRARY -#define CONTROL_MODE_HANDLER_PUBLIC CONTROL_MODE_HANDLER_EXPORT -#else -#define CONTROL_MODE_HANDLER_PUBLIC CONTROL_MODE_HANDLER_IMPORT -#endif -#define CONTROL_MODE_HANDLER_PUBLIC_TYPE CONTROL_MODE_HANDLER_PUBLIC -#define CONTROL_MODE_HANDLER_LOCAL -#else -#define CONTROL_MODE_HANDLER_EXPORT __attribute__((visibility("default"))) -#define CONTROL_MODE_HANDLER_IMPORT -#if __GNUC__ >= 4 -#define CONTROL_MODE_HANDLER_PUBLIC __attribute__((visibility("default"))) -#define CONTROL_MODE_HANDLER_LOCAL __attribute__((visibility("hidden"))) -#else -#define CONTROL_MODE_HANDLER_PUBLIC -#define CONTROL_MODE_HANDLER_LOCAL -#endif -#define CONTROL_MODE_HANDLER_PUBLIC_TYPE -#endif - -#endif // CONTROL_MODE_HANDLER__VISIBILITY_CONTROL_H_ diff --git a/controllers/event_broadcaster/include/event_broadcaster/visibility_control.h b/controllers/event_broadcaster/include/event_broadcaster/visibility_control.h deleted file mode 100644 index 8374e754..00000000 --- a/controllers/event_broadcaster/include/event_broadcaster/visibility_control.h +++ /dev/null @@ -1,49 +0,0 @@ -// Copyright 2024 Aron Svastits -// -// 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 -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// 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. - -#ifndef EVENT_BROADCASTER__VISIBILITY_CONTROL_H_ -#define EVENT_BROADCASTER__VISIBILITY_CONTROL_H_ - -// This logic was borrowed (then namespaced) from the examples on the gcc wiki: -// https://gcc.gnu.org/wiki/Visibility - -#if defined _WIN32 || defined __CYGWIN__ -#ifdef __GNUC__ -#define EVENT_BROADCASTER_EXPORT __attribute__((dllexport)) -#define EVENT_BROADCASTER_IMPORT __attribute__((dllimport)) -#else -#define EVENT_BROADCASTER_EXPORT __declspec(dllexport) -#define EVENT_BROADCASTER_IMPORT __declspec(dllimport) -#endif -#ifdef EVENT_BROADCASTER_BUILDING_LIBRARY -#define EVENT_BROADCASTER_PUBLIC EVENT_BROADCASTER_EXPORT -#else -#define EVENT_BROADCASTER_PUBLIC EVENT_BROADCASTER_IMPORT -#endif -#define EVENT_BROADCASTER_PUBLIC_TYPE EVENT_BROADCASTER_PUBLIC -#define EVENT_BROADCASTER_LOCAL -#else -#define EVENT_BROADCASTER_EXPORT __attribute__((visibility("default"))) -#define EVENT_BROADCASTER_IMPORT -#if __GNUC__ >= 4 -#define EVENT_BROADCASTER_PUBLIC __attribute__((visibility("default"))) -#define EVENT_BROADCASTER_LOCAL __attribute__((visibility("hidden"))) -#else -#define EVENT_BROADCASTER_PUBLIC -#define EVENT_BROADCASTER_LOCAL -#endif -#define EVENT_BROADCASTER_PUBLIC_TYPE -#endif - -#endif // EVENT_BROADCASTER__VISIBILITY_CONTROL_H_ diff --git a/controllers/control_mode_handler/CMakeLists.txt b/controllers/kuka_control_mode_handler/CMakeLists.txt similarity index 88% rename from controllers/control_mode_handler/CMakeLists.txt rename to controllers/kuka_control_mode_handler/CMakeLists.txt index de115c17..7ac88374 100644 --- a/controllers/control_mode_handler/CMakeLists.txt +++ b/controllers/kuka_control_mode_handler/CMakeLists.txt @@ -1,5 +1,5 @@ cmake_minimum_required(VERSION 3.5) -project(control_mode_handler) +project(kuka_control_mode_handler) if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang") add_compile_options(-Wall -Wextra) @@ -13,7 +13,7 @@ find_package(kuka_drivers_core REQUIRED) include_directories(include) add_library(${PROJECT_NAME} SHARED - src/control_mode_handler.cpp) + src/kuka_control_mode_handler.cpp) target_include_directories(${PROJECT_NAME} PRIVATE include @@ -24,7 +24,7 @@ ament_target_dependencies(${PROJECT_NAME} controller_interface std_msgs kuka_dri # Causes the visibility macros to use dllexport rather than dllimport, # which is appropriate when building the dll but not consuming it. -target_compile_definitions(${PROJECT_NAME} PRIVATE "CONTROL_MODE_HANDLER_BUILDING_LIBRARY") +target_compile_definitions(${PROJECT_NAME} PRIVATE "KUKA_CONTROL_MODE_HANDLER_BUILDING_LIBRARY") # prevent pluginlib from using boost target_compile_definitions(${PROJECT_NAME} PUBLIC "PLUGINLIB__DISABLE_BOOST_FUNCTIONS") diff --git a/controllers/control_mode_handler/controller_plugins.xml b/controllers/kuka_control_mode_handler/controller_plugins.xml similarity index 86% rename from controllers/control_mode_handler/controller_plugins.xml rename to controllers/kuka_control_mode_handler/controller_plugins.xml index 9559360a..b202e04a 100644 --- a/controllers/control_mode_handler/controller_plugins.xml +++ b/controllers/kuka_control_mode_handler/controller_plugins.xml @@ -1,4 +1,4 @@ - + This controller sets the control mode of KUKA robots in runtime diff --git a/controllers/control_mode_handler/include/control_mode_handler/control_mode_handler.hpp b/controllers/kuka_control_mode_handler/include/kuka_control_mode_handler/kuka_control_mode_handler.hpp similarity index 65% rename from controllers/control_mode_handler/include/control_mode_handler/control_mode_handler.hpp rename to controllers/kuka_control_mode_handler/include/kuka_control_mode_handler/kuka_control_mode_handler.hpp index 3fa559c8..20e9f1f4 100644 --- a/controllers/control_mode_handler/include/control_mode_handler/control_mode_handler.hpp +++ b/controllers/kuka_control_mode_handler/include/kuka_control_mode_handler/kuka_control_mode_handler.hpp @@ -12,8 +12,8 @@ // See the License for the specific language governing permissions and // limitations under the License. -#ifndef CONTROL_MODE_HANDLER__CONTROL_MODE_HANDLER_HPP_ -#define CONTROL_MODE_HANDLER__CONTROL_MODE_HANDLER_HPP_ +#ifndef KUKA_CONTROL_MODE_HANDLER__KUKA_CONTROL_MODE_HANDLER_HPP_ +#define KUKA_CONTROL_MODE_HANDLER__KUKA_CONTROL_MODE_HANDLER_HPP_ #include #include @@ -26,32 +26,32 @@ #include "rclcpp/time.hpp" #include "std_msgs/msg/u_int32.hpp" -#include "control_mode_handler/visibility_control.h" +#include "kuka_control_mode_handler/visibility_control.h" namespace kuka_controllers { class ControlModeHandler : public controller_interface::ControllerInterface { public: - CONTROL_MODE_HANDLER_PUBLIC controller_interface::InterfaceConfiguration + KUKA_CONTROL_MODE_HANDLER_PUBLIC controller_interface::InterfaceConfiguration command_interface_configuration() const override; - CONTROL_MODE_HANDLER_PUBLIC controller_interface::InterfaceConfiguration + KUKA_CONTROL_MODE_HANDLER_PUBLIC controller_interface::InterfaceConfiguration state_interface_configuration() const override; - CONTROL_MODE_HANDLER_PUBLIC controller_interface::return_type update( + KUKA_CONTROL_MODE_HANDLER_PUBLIC controller_interface::return_type update( const rclcpp::Time & time, const rclcpp::Duration & period) override; - CONTROL_MODE_HANDLER_PUBLIC controller_interface::CallbackReturn on_configure( + KUKA_CONTROL_MODE_HANDLER_PUBLIC controller_interface::CallbackReturn on_configure( const rclcpp_lifecycle::State & previous_state) override; - CONTROL_MODE_HANDLER_PUBLIC controller_interface::CallbackReturn on_activate( + KUKA_CONTROL_MODE_HANDLER_PUBLIC controller_interface::CallbackReturn on_activate( const rclcpp_lifecycle::State & previous_state) override; - CONTROL_MODE_HANDLER_PUBLIC controller_interface::CallbackReturn on_deactivate( + KUKA_CONTROL_MODE_HANDLER_PUBLIC controller_interface::CallbackReturn on_deactivate( const rclcpp_lifecycle::State & previous_state) override; - CONTROL_MODE_HANDLER_PUBLIC controller_interface::CallbackReturn on_init() override; + KUKA_CONTROL_MODE_HANDLER_PUBLIC controller_interface::CallbackReturn on_init() override; private: rclcpp::Subscription::SharedPtr control_mode_subscriber_; @@ -59,4 +59,4 @@ class ControlModeHandler : public controller_interface::ControllerInterface kuka_drivers_core::ControlMode::CONTROL_MODE_UNSPECIFIED; }; } // namespace kuka_controllers -#endif // CONTROL_MODE_HANDLER__CONTROL_MODE_HANDLER_HPP_ +#endif // KUKA_CONTROL_MODE_HANDLER__KUKA_CONTROL_MODE_HANDLER_HPP_ diff --git a/controllers/kuka_control_mode_handler/include/kuka_control_mode_handler/visibility_control.h b/controllers/kuka_control_mode_handler/include/kuka_control_mode_handler/visibility_control.h new file mode 100644 index 00000000..53f33647 --- /dev/null +++ b/controllers/kuka_control_mode_handler/include/kuka_control_mode_handler/visibility_control.h @@ -0,0 +1,49 @@ +// Copyright 2023 Aron Svastits +// +// 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 +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// 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. + +#ifndef KUKA_CONTROL_MODE_HANDLER__VISIBILITY_CONTROL_H_ +#define KUKA_CONTROL_MODE_HANDLER__VISIBILITY_CONTROL_H_ + +// This logic was borrowed (then namespaced) from the examples on the gcc wiki: +// https://gcc.gnu.org/wiki/Visibility + +#if defined _WIN32 || defined __CYGWIN__ +#ifdef __GNUC__ +#define KUKA_CONTROL_MODE_HANDLER_EXPORT __attribute__((dllexport)) +#define KUKA_CONTROL_MODE_HANDLER_IMPORT __attribute__((dllimport)) +#else +#define KUKA_CONTROL_MODE_HANDLER_EXPORT __declspec(dllexport) +#define KUKA_CONTROL_MODE_HANDLER_IMPORT __declspec(dllimport) +#endif +#ifdef KUKA_CONTROL_MODE_HANDLER_BUILDING_LIBRARY +#define KUKA_CONTROL_MODE_HANDLER_PUBLIC KUKA_CONTROL_MODE_HANDLER_EXPORT +#else +#define KUKA_CONTROL_MODE_HANDLER_PUBLIC KUKA_CONTROL_MODE_HANDLER_IMPORT +#endif +#define KUKA_CONTROL_MODE_HANDLER_PUBLIC_TYPE KUKA_CONTROL_MODE_HANDLER_PUBLIC +#define KUKA_CONTROL_MODE_HANDLER_LOCAL +#else +#define KUKA_CONTROL_MODE_HANDLER_EXPORT __attribute__((visibility("default"))) +#define KUKA_CONTROL_MODE_HANDLER_IMPORT +#if __GNUC__ >= 4 +#define KUKA_CONTROL_MODE_HANDLER_PUBLIC __attribute__((visibility("default"))) +#define KUKA_CONTROL_MODE_HANDLER_LOCAL __attribute__((visibility("hidden"))) +#else +#define KUKA_CONTROL_MODE_HANDLER_PUBLIC +#define KUKA_CONTROL_MODE_HANDLER_LOCAL +#endif +#define KUKA_CONTROL_MODE_HANDLER_PUBLIC_TYPE +#endif + +#endif // KUKA_CONTROL_MODE_HANDLER__VISIBILITY_CONTROL_H_ diff --git a/controllers/control_mode_handler/package.xml b/controllers/kuka_control_mode_handler/package.xml similarity index 93% rename from controllers/control_mode_handler/package.xml rename to controllers/kuka_control_mode_handler/package.xml index 558b1882..6f6fe82f 100644 --- a/controllers/control_mode_handler/package.xml +++ b/controllers/kuka_control_mode_handler/package.xml @@ -1,7 +1,7 @@ - control_mode_handler + kuka_control_mode_handler 0.9.0 Controller for setting the control mode of KUKA robots in runtime diff --git a/controllers/control_mode_handler/src/control_mode_handler.cpp b/controllers/kuka_control_mode_handler/src/kuka_control_mode_handler.cpp similarity index 97% rename from controllers/control_mode_handler/src/control_mode_handler.cpp rename to controllers/kuka_control_mode_handler/src/kuka_control_mode_handler.cpp index 16ea448a..de979070 100644 --- a/controllers/control_mode_handler/src/control_mode_handler.cpp +++ b/controllers/kuka_control_mode_handler/src/kuka_control_mode_handler.cpp @@ -14,7 +14,7 @@ #include "kuka_drivers_core/hardware_interface_types.hpp" -#include "control_mode_handler/control_mode_handler.hpp" +#include "kuka_control_mode_handler/kuka_control_mode_handler.hpp" namespace kuka_controllers { diff --git a/controllers/kuka_controllers/package.xml b/controllers/kuka_controllers/package.xml index 7d6112f9..40bac813 100644 --- a/controllers/kuka_controllers/package.xml +++ b/controllers/kuka_controllers/package.xml @@ -8,8 +8,8 @@ ament_cmake - control_mode_handler - event_broadcaster + kuka_control_mode_handler + kuka_event_broadcaster fri_configuration_controller fri_state_broadcaster joint_group_impedance_controller diff --git a/controllers/event_broadcaster/CMakeLists.txt b/controllers/kuka_event_broadcaster/CMakeLists.txt similarity index 89% rename from controllers/event_broadcaster/CMakeLists.txt rename to controllers/kuka_event_broadcaster/CMakeLists.txt index b2a86670..ebf85c95 100644 --- a/controllers/event_broadcaster/CMakeLists.txt +++ b/controllers/kuka_event_broadcaster/CMakeLists.txt @@ -1,5 +1,5 @@ cmake_minimum_required(VERSION 3.5) -project(event_broadcaster) +project(kuka_event_broadcaster) if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang") add_compile_options(-Wall -Wextra) @@ -13,7 +13,7 @@ find_package(kuka_drivers_core REQUIRED) include_directories(include) add_library(${PROJECT_NAME} SHARED - src/event_broadcaster.cpp) + src/kuka_event_broadcaster.cpp) target_include_directories(${PROJECT_NAME} PRIVATE include @@ -24,7 +24,7 @@ ament_target_dependencies(${PROJECT_NAME} controller_interface kuka_drivers_core # Causes the visibility macros to use dllexport rather than dllimport, # which is appropriate when building the dll but not consuming it. -target_compile_definitions(${PROJECT_NAME} PRIVATE "EVENT_BROADCASTER_BUILDING_LIBRARY") +target_compile_definitions(${PROJECT_NAME} PRIVATE "KUKA_EVENT_BROADCASTER_BUILDING_LIBRARY") # prevent pluginlib from using boost target_compile_definitions(${PROJECT_NAME} PUBLIC "PLUGINLIB__DISABLE_BOOST_FUNCTIONS") diff --git a/controllers/event_broadcaster/controller_plugins.xml b/controllers/kuka_event_broadcaster/controller_plugins.xml similarity index 87% rename from controllers/event_broadcaster/controller_plugins.xml rename to controllers/kuka_event_broadcaster/controller_plugins.xml index 66105bdc..27b950cc 100644 --- a/controllers/event_broadcaster/controller_plugins.xml +++ b/controllers/kuka_event_broadcaster/controller_plugins.xml @@ -1,4 +1,4 @@ - + This broadcaster publishes the state changes of ECI diff --git a/controllers/event_broadcaster/include/event_broadcaster/event_broadcaster.hpp b/controllers/kuka_event_broadcaster/include/kuka_event_broadcaster/kuka_event_broadcaster.hpp similarity index 65% rename from controllers/event_broadcaster/include/event_broadcaster/event_broadcaster.hpp rename to controllers/kuka_event_broadcaster/include/kuka_event_broadcaster/kuka_event_broadcaster.hpp index 507538ca..87e98254 100644 --- a/controllers/event_broadcaster/include/event_broadcaster/event_broadcaster.hpp +++ b/controllers/kuka_event_broadcaster/include/kuka_event_broadcaster/kuka_event_broadcaster.hpp @@ -12,8 +12,8 @@ // See the License for the specific language governing permissions and // limitations under the License. -#ifndef EVENT_BROADCASTER__EVENT_BROADCASTER_HPP_ -#define EVENT_BROADCASTER__EVENT_BROADCASTER_HPP_ +#ifndef KUKA_EVENT_BROADCASTER__KUKA_EVENT_BROADCASTER_HPP_ +#define KUKA_EVENT_BROADCASTER__KUKA_EVENT_BROADCASTER_HPP_ #include #include @@ -25,32 +25,32 @@ #include "rclcpp/time.hpp" #include "std_msgs/msg/u_int8.hpp" -#include "event_broadcaster/visibility_control.h" +#include "kuka_event_broadcaster/visibility_control.h" namespace kuka_controllers { class EventBroadcaster : public controller_interface::ControllerInterface { public: - EVENT_BROADCASTER_PUBLIC controller_interface::InterfaceConfiguration + KUKA_EVENT_BROADCASTER_PUBLIC controller_interface::InterfaceConfiguration command_interface_configuration() const override; - EVENT_BROADCASTER_PUBLIC controller_interface::InterfaceConfiguration + KUKA_EVENT_BROADCASTER_PUBLIC controller_interface::InterfaceConfiguration state_interface_configuration() const override; - EVENT_BROADCASTER_PUBLIC controller_interface::return_type update( + KUKA_EVENT_BROADCASTER_PUBLIC controller_interface::return_type update( const rclcpp::Time & time, const rclcpp::Duration & period) override; - EVENT_BROADCASTER_PUBLIC controller_interface::CallbackReturn on_configure( + KUKA_EVENT_BROADCASTER_PUBLIC controller_interface::CallbackReturn on_configure( const rclcpp_lifecycle::State & previous_state) override; - EVENT_BROADCASTER_PUBLIC controller_interface::CallbackReturn on_activate( + KUKA_EVENT_BROADCASTER_PUBLIC controller_interface::CallbackReturn on_activate( const rclcpp_lifecycle::State & previous_state) override; - EVENT_BROADCASTER_PUBLIC controller_interface::CallbackReturn on_deactivate( + KUKA_EVENT_BROADCASTER_PUBLIC controller_interface::CallbackReturn on_deactivate( const rclcpp_lifecycle::State & previous_state) override; - EVENT_BROADCASTER_PUBLIC controller_interface::CallbackReturn on_init() override; + KUKA_EVENT_BROADCASTER_PUBLIC controller_interface::CallbackReturn on_init() override; private: rclcpp::Publisher::SharedPtr event_publisher_; @@ -58,4 +58,4 @@ class EventBroadcaster : public controller_interface::ControllerInterface int last_event_ = 0; }; } // namespace kuka_controllers -#endif // EVENT_BROADCASTER__EVENT_BROADCASTER_HPP_ +#endif // KUKA_EVENT_BROADCASTER__KUKA_EVENT_BROADCASTER_HPP_ diff --git a/controllers/kuka_event_broadcaster/include/kuka_event_broadcaster/visibility_control.h b/controllers/kuka_event_broadcaster/include/kuka_event_broadcaster/visibility_control.h new file mode 100644 index 00000000..bf4fc7e6 --- /dev/null +++ b/controllers/kuka_event_broadcaster/include/kuka_event_broadcaster/visibility_control.h @@ -0,0 +1,49 @@ +// Copyright 2024 Aron Svastits +// +// 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 +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// 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. + +#ifndef KUKA_EVENT_BROADCASTER__VISIBILITY_CONTROL_H_ +#define KUKA_EVENT_BROADCASTER__VISIBILITY_CONTROL_H_ + +// This logic was borrowed (then namespaced) from the examples on the gcc wiki: +// https://gcc.gnu.org/wiki/Visibility + +#if defined _WIN32 || defined __CYGWIN__ +#ifdef __GNUC__ +#define KUKA_EVENT_BROADCASTER_EXPORT __attribute__((dllexport)) +#define KUKA_EVENT_BROADCASTER_IMPORT __attribute__((dllimport)) +#else +#define KUKA_EVENT_BROADCASTER_EXPORT __declspec(dllexport) +#define KUKA_EVENT_BROADCASTER_IMPORT __declspec(dllimport) +#endif +#ifdef KUKA_EVENT_BROADCASTER_BUILDING_LIBRARY +#define KUKA_EVENT_BROADCASTER_PUBLIC KUKA_EVENT_BROADCASTER_EXPORT +#else +#define KUKA_EVENT_BROADCASTER_PUBLIC KUKA_EVENT_BROADCASTER_IMPORT +#endif +#define KUKA_EVENT_BROADCASTER_PUBLIC_TYPE KUKA_EVENT_BROADCASTER_PUBLIC +#define KUKA_EVENT_BROADCASTER_LOCAL +#else +#define KUKA_EVENT_BROADCASTER_EXPORT __attribute__((visibility("default"))) +#define KUKA_EVENT_BROADCASTER_IMPORT +#if __GNUC__ >= 4 +#define KUKA_EVENT_BROADCASTER_PUBLIC __attribute__((visibility("default"))) +#define KUKA_EVENT_BROADCASTER_LOCAL __attribute__((visibility("hidden"))) +#else +#define KUKA_EVENT_BROADCASTER_PUBLIC +#define KUKA_EVENT_BROADCASTER_LOCAL +#endif +#define KUKA_EVENT_BROADCASTER_PUBLIC_TYPE +#endif + +#endif // KUKA_EVENT_BROADCASTER__VISIBILITY_CONTROL_H_ diff --git a/controllers/event_broadcaster/package.xml b/controllers/kuka_event_broadcaster/package.xml similarity index 94% rename from controllers/event_broadcaster/package.xml rename to controllers/kuka_event_broadcaster/package.xml index e851fe48..04aa4b2a 100644 --- a/controllers/event_broadcaster/package.xml +++ b/controllers/kuka_event_broadcaster/package.xml @@ -1,7 +1,7 @@ - event_broadcaster + kuka_event_broadcaster 0.9.0 Broadcaster of hardware events of KUKA robots diff --git a/controllers/event_broadcaster/src/event_broadcaster.cpp b/controllers/kuka_event_broadcaster/src/kuka_event_broadcaster.cpp similarity index 97% rename from controllers/event_broadcaster/src/event_broadcaster.cpp rename to controllers/kuka_event_broadcaster/src/kuka_event_broadcaster.cpp index 34af4422..1177ee7e 100644 --- a/controllers/event_broadcaster/src/event_broadcaster.cpp +++ b/controllers/kuka_event_broadcaster/src/kuka_event_broadcaster.cpp @@ -14,7 +14,7 @@ #include "kuka_drivers_core/hardware_interface_types.hpp" -#include "event_broadcaster/event_broadcaster.hpp" +#include "kuka_event_broadcaster/kuka_event_broadcaster.hpp" namespace kuka_controllers { diff --git a/doc/wiki/1_iiQKA_EAC.md b/doc/wiki/1_iiQKA_EAC.md index f830478f..674a743c 100644 --- a/doc/wiki/1_iiQKA_EAC.md +++ b/doc/wiki/1_iiQKA_EAC.md @@ -54,7 +54,7 @@ This starts the 3 core components of every driver (described in the [Non-real-ti - `joint_trajectory_controller` ([configuration file](https://github.com/kroshu/kuka_drivers/tree/master/kuka_iiqka_eac_driver/config/joint_trajectory_controller_config.yaml)) - `joint_group_impedance_controller` ([configuration file](https://github.com/kroshu/kuka_drivers/tree/master/kuka_iiqka_eac_driver/config/joint_impedance_controller_config.yaml)) - `effort_controller` (of type `JointGroupPositionController`, [configuration file](https://github.com/kroshu/kuka_drivers/tree/master/kuka_iiqka_eac_driver/config/effort_controller_config.yaml)) -- [`control_mode_handler`](https://github.com/kroshu/kuka_drivers/wiki/4_Controllers#control_mode_handler) (no configuration file) +- [`kuka_control_mode_handler`](https://github.com/kroshu/kuka_drivers/wiki/4_Controllers#kuka_control_mode_handler) (no configuration file) After successful startup, the `robot_manager` node has to be activated to start the cyclic communication with the robot controller (before this only a collapsed robot is visible in `rviz`): ``` diff --git a/doc/wiki/4_Controllers.md b/doc/wiki/4_Controllers.md index 1ec94a59..4be12a7a 100644 --- a/doc/wiki/4_Controllers.md +++ b/doc/wiki/4_Controllers.md @@ -29,7 +29,7 @@ The `FRIStateBroadcaster` publishes the actual state of FRI to the `~/fri_state` __Required parameters__: None -#### `event_broadcaster` +#### `kuka_event_broadcaster` The `EventBroadcaster` publishes server state change events as integers (enum values) on the `~/hardware_event` topic. The enum values are equivalent with the following events: - 2: Start command was accepted by the robot controller @@ -44,7 +44,7 @@ __Required parameters__: None Hardware interfaces do not support parameters that can be changed in runtime. To provide this behaviour, configuration controllers can be used, which update specific command interfaces of a hardware, that are exported as a workaround instead of parameters. -#### `control_mode_handler` +#### `kuka_control_mode_handler` The `ControlModeHandler` can update the `control_mode` command interface of a hardware. It listens on the `~/control_mode` topic and makes control mode changes possible without having to reactivate the driver. The control mode is [defined as an enum](https://github.com/kroshu/kuka_drivers/blob/master/kuka_drivers_core/include/kuka_drivers_core/control_mode.hpp) in the `kuka_drivers_core` package, the subscription therefore is of an unsigned integer type. diff --git a/kuka_iiqka_eac_driver/package.xml b/kuka_iiqka_eac_driver/package.xml index bbe5e6d1..060a58d5 100644 --- a/kuka_iiqka_eac_driver/package.xml +++ b/kuka_iiqka_eac_driver/package.xml @@ -23,8 +23,8 @@ joint_trajectory_controller effort_controllers joint_state_broadcaster - control_mode_handler - event_broadcaster + kuka_control_mode_handler + kuka_event_broadcaster joint_group_impedance_controller ros2lifecycle diff --git a/kuka_iiqka_eac_driver/src/robot_manager_node.cpp b/kuka_iiqka_eac_driver/src/robot_manager_node.cpp index bd545f14..50c09517 100644 --- a/kuka_iiqka_eac_driver/src/robot_manager_node.cpp +++ b/kuka_iiqka_eac_driver/src/robot_manager_node.cpp @@ -46,13 +46,13 @@ RobotManagerNode::RobotManagerNode() : kuka_drivers_core::ROS2BaseLCNode("robot_ this->create_publisher("robot_manager/is_configured", is_configured_qos); control_mode_pub_ = this->create_publisher( - "control_mode_handler/control_mode", rclcpp::SystemDefaultsQoS()); + "kuka_control_mode_handler/control_mode", rclcpp::SystemDefaultsQoS()); rclcpp::SubscriptionOptions sub_options; sub_options.callback_group = event_cbg_; event_subscriber_ = this->create_subscription( - "event_broadcaster/hardware_event", rclcpp::SystemDefaultsQoS(), + "kuka_event_broadcaster/hardware_event", rclcpp::SystemDefaultsQoS(), [this](const std_msgs::msg::UInt8::SharedPtr msg) { this->EventSubscriptionCallback(msg); }, sub_options); @@ -99,7 +99,7 @@ RobotManagerNode::RobotManagerNode() : kuka_drivers_core::ROS2BaseLCNode("robot_ rclcpp_lifecycle::node_interfaces::LifecycleNodeInterface::CallbackReturn RobotManagerNode::on_configure(const rclcpp_lifecycle::State &) { - // Publish control mode parameter to notify control_mode_handler of initial control mode + // Publish control mode parameter to notify kuka_control_mode_handler of initial control mode auto message = std_msgs::msg::UInt32(); message.data = static_cast(control_mode_); control_mode_pub_->publish(message); diff --git a/sonar-project.properties b/sonar-project.properties index 1323fdaa..7618e2f2 100644 --- a/sonar-project.properties +++ b/sonar-project.properties @@ -19,7 +19,7 @@ kuka_iiqka_eac_driver.sonar.exclusions=**/mock/** kuka_drivers_core.sonar.projectName=kuka_drivers_core kuka_drivers_core.sonar.sources=./src,./include controllers.sonar.projectName=controllers -controllers.sonar.sources=./control_mode_handler, ./event_broadcaster, ./fri_configuration_controller, ./fri_state_broadcaster, ./joint_group_impedance_controller +controllers.sonar.sources=./kuka_control_mode_handler, ./kuka_event_broadcaster, ./fri_configuration_controller, ./fri_state_broadcaster, ./joint_group_impedance_controller # Encoding of the source code. Default is default system encoding sonar.sourceEncoding=UTF-8