From cb92c50a2a90b5471be0e849d2b3569b1a11524b Mon Sep 17 00:00:00 2001 From: "Felix Exner (fexner)" Date: Fri, 5 May 2023 20:11:05 +0200 Subject: [PATCH 1/6] docs: Fix link to hardware_components (#1009) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Fix link to hardware_components Fix the link to the hardware_components documentation to a working version. * use sphinx ref Co-authored-by: Christoph Fröhlich --------- Co-authored-by: Christoph Fröhlich --- hardware_interface/doc/hardware_components_userdoc.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hardware_interface/doc/hardware_components_userdoc.rst b/hardware_interface/doc/hardware_components_userdoc.rst index 33230ffed1..e6a9bf5029 100644 --- a/hardware_interface/doc/hardware_components_userdoc.rst +++ b/hardware_interface/doc/hardware_components_userdoc.rst @@ -4,7 +4,7 @@ Hardware Components ------------------- Hardware components represent abstraction of physical hardware in ros2_control framework. There are three types of hardware Actuator, Sensor and System. -For details on each type check `Hardware Components description `_. +For details on each type check :ref:`overview_hardware_components` description. Guidelines and Best Practices ***************************** From e3f38ccbf8f3d7ebc56215780a430fe1a1b23cd7 Mon Sep 17 00:00:00 2001 From: bijoua29 <73511637+bijoua29@users.noreply.github.com> Date: Tue, 9 May 2023 09:39:39 -0700 Subject: [PATCH 2/6] Remove log-level argument from spawner script (#1013) Use standard ros-args instead --- .../controller_manager/spawner.py | 17 ----------------- 1 file changed, 17 deletions(-) diff --git a/controller_manager/controller_manager/spawner.py b/controller_manager/controller_manager/spawner.py index 24aad0ae78..8463c11b19 100644 --- a/controller_manager/controller_manager/spawner.py +++ b/controller_manager/controller_manager/spawner.py @@ -184,13 +184,6 @@ def main(args=None): default=10, type=int, ) - parser.add_argument( - "--log-level", - help="Log level for spawner node", - required=False, - choices=["debug", "info", "warn", "error", "fatal"], - default="info", - ) command_line_args = rclpy.utilities.remove_ros_args(args=sys.argv)[1:] args = parser.parse_args(command_line_args) @@ -200,15 +193,6 @@ def main(args=None): param_file = args.param_file controller_type = args.controller_type controller_manager_timeout = args.controller_manager_timeout - log_level = args.log_level - - loglevel_to_severity = { - "debug": rclpy.logging.LoggingSeverity.DEBUG, - "info": rclpy.logging.LoggingSeverity.INFO, - "warn": rclpy.logging.LoggingSeverity.WARN, - "error": rclpy.logging.LoggingSeverity.ERROR, - "fatal": rclpy.logging.LoggingSeverity.FATAL, - } if param_file and not os.path.isfile(param_file): raise FileNotFoundError(errno.ENOENT, os.strerror(errno.ENOENT), param_file) @@ -218,7 +202,6 @@ def main(args=None): prefixed_controller_name = controller_namespace + "/" + controller_name node = Node("spawner_" + controller_name) - rclpy.logging.set_logger_level("spawner_" + controller_name, loglevel_to_severity[log_level]) if not controller_manager_name.startswith("/"): spawner_namespace = node.get_namespace() From c9709f3ce2ebf31ab5ea2c25829c422f7465f0d7 Mon Sep 17 00:00:00 2001 From: Alejandro Bordallo Date: Wed, 10 May 2023 23:19:00 +0100 Subject: [PATCH 3/6] Implement parse_bool and refactor a few (#1014) --- .../include/hardware_interface/component_parser.hpp | 3 +++ hardware_interface/src/component_parser.cpp | 7 ++++++- .../src/mock_components/generic_system.cpp | 9 ++++----- 3 files changed, 13 insertions(+), 6 deletions(-) diff --git a/hardware_interface/include/hardware_interface/component_parser.hpp b/hardware_interface/include/hardware_interface/component_parser.hpp index 1d0f07d94b..9f81a2a863 100644 --- a/hardware_interface/include/hardware_interface/component_parser.hpp +++ b/hardware_interface/include/hardware_interface/component_parser.hpp @@ -33,5 +33,8 @@ namespace hardware_interface HARDWARE_INTERFACE_PUBLIC std::vector parse_control_resources_from_urdf(const std::string & urdf); +HARDWARE_INTERFACE_PUBLIC +bool parse_bool(const std::string & bool_string); + } // namespace hardware_interface #endif // HARDWARE_INTERFACE__COMPONENT_PARSER_HPP_ diff --git a/hardware_interface/src/component_parser.cpp b/hardware_interface/src/component_parser.cpp index 14f2dee21e..46c6b5f0e0 100644 --- a/hardware_interface/src/component_parser.cpp +++ b/hardware_interface/src/component_parser.cpp @@ -224,7 +224,7 @@ std::string parse_data_type_attribute(const tinyxml2::XMLElement * elem) bool parse_is_async_attribute(const tinyxml2::XMLElement * elem) { const tinyxml2::XMLAttribute * attr = elem->FindAttribute(kIsAsyncAttribute); - return attr ? strcasecmp(attr->Value(), "true") == 0 : false; + return attr ? parse_bool(attr->Value()) : false; } /// Search XML snippet from URDF for parameters. @@ -612,4 +612,9 @@ std::vector parse_control_resources_from_urdf(const std::string & return hardware_info; } +bool parse_bool(const std::string & bool_string) +{ + return bool_string == "true" || bool_string == "True"; +} + } // namespace hardware_interface diff --git a/hardware_interface/src/mock_components/generic_system.cpp b/hardware_interface/src/mock_components/generic_system.cpp index d1405dac8c..04f0884607 100644 --- a/hardware_interface/src/mock_components/generic_system.cpp +++ b/hardware_interface/src/mock_components/generic_system.cpp @@ -25,6 +25,7 @@ #include #include +#include "hardware_interface/component_parser.hpp" #include "hardware_interface/types/hardware_interface_type_values.hpp" #include "rcutils/logging_macros.h" @@ -74,8 +75,7 @@ CallbackReturn GenericSystem::on_init(const hardware_interface::HardwareInfo & i auto it = info_.hardware_parameters.find("mock_sensor_commands"); if (it != info_.hardware_parameters.end()) { - // TODO(anyone): change this to parse_bool() (see ros2_control#339) - use_mock_sensor_command_interfaces_ = it->second == "true" || it->second == "True"; + use_mock_sensor_command_interfaces_ = hardware_interface::parse_bool(it->second); } else { @@ -83,7 +83,7 @@ CallbackReturn GenericSystem::on_init(const hardware_interface::HardwareInfo & i it = info_.hardware_parameters.find("fake_sensor_commands"); if (it != info_.hardware_parameters.end()) { - use_mock_sensor_command_interfaces_ = it->second == "true" || it->second == "True"; + use_mock_sensor_command_interfaces_ = hardware_interface::parse_bool(it->second); RCUTILS_LOG_WARN_NAMED( "fake_generic_system", "Parameter 'fake_sensor_commands' has been deprecated from usage. Use" @@ -99,8 +99,7 @@ CallbackReturn GenericSystem::on_init(const hardware_interface::HardwareInfo & i it = info_.hardware_parameters.find("fake_gpio_commands"); if (it != info_.hardware_parameters.end()) { - // TODO(anyone): change this to parse_bool() (see ros2_control#339) - use_fake_gpio_command_interfaces_ = it->second == "true" || it->second == "True"; + use_fake_gpio_command_interfaces_ = hardware_interface::parse_bool(it->second); } else { From f0e72f8b6342b985198513e246c10e4c12c48443 Mon Sep 17 00:00:00 2001 From: mosfet80 Date: Sun, 14 May 2023 11:42:44 +0200 Subject: [PATCH 4/6] Update precommit libraries(#1020) --- .pre-commit-config.yaml | 6 +++--- hardware_interface/src/mock_components/generic_system.cpp | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index d4f6fea70b..0ad4d0aa6c 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -36,7 +36,7 @@ repos: # Python hooks - repo: https://github.com/asottile/pyupgrade - rev: v3.3.1 + rev: v3.4.0 hooks: - id: pyupgrade args: [--py36-plus] @@ -49,7 +49,7 @@ repos: args: ["--ignore=D100,D101,D102,D103,D104,D105,D106,D107,D203,D212,D404"] - repo: https://github.com/psf/black - rev: 23.1.0 + rev: 23.3.0 hooks: - id: black args: ["--line-length=99"] @@ -128,7 +128,7 @@ repos: # Spellcheck in comments and docs # skipping of *.svg files is not working... - repo: https://github.com/codespell-project/codespell - rev: v2.2.2 + rev: v2.2.4 hooks: - id: codespell args: ['--write-changes'] diff --git a/hardware_interface/src/mock_components/generic_system.cpp b/hardware_interface/src/mock_components/generic_system.cpp index 04f0884607..d2c2e56510 100644 --- a/hardware_interface/src/mock_components/generic_system.cpp +++ b/hardware_interface/src/mock_components/generic_system.cpp @@ -120,7 +120,7 @@ CallbackReturn GenericSystem::on_init(const hardware_interface::HardwareInfo & i custom_interface_with_following_offset_ = it->second; } } - // its extremlly unprobably that std::distance results int this value - therefore default + // it's extremely improbable that std::distance results int this value - therefore default index_custom_interface_with_following_offset_ = std::numeric_limits::max(); // Initialize storage for standard interfaces From 5065d0c22faa021aadceea3c42407a9b9e724eb7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christoph=20Fr=C3=B6hlich?= Date: Sun, 14 May 2023 20:53:20 +0200 Subject: [PATCH 5/6] Fix github links on control.ros.org (#1019) --- doc/index.rst | 2 ++ hardware_interface/doc/hardware_components_userdoc.rst | 2 ++ hardware_interface/doc/mock_components_userdoc.rst | 2 ++ hardware_interface/doc/writing_new_hardware_interface.rst | 2 ++ ros2controlcli/doc/userdoc.rst | 2 ++ 5 files changed, 10 insertions(+) diff --git a/doc/index.rst b/doc/index.rst index 5821b795f3..b5e9c78fbe 100644 --- a/doc/index.rst +++ b/doc/index.rst @@ -1,3 +1,5 @@ +:github_url: https://github.com/ros-controls/ros2_control/blob/|github_branch|/doc/index.rst + .. _ros2_control_framework: ################# diff --git a/hardware_interface/doc/hardware_components_userdoc.rst b/hardware_interface/doc/hardware_components_userdoc.rst index e6a9bf5029..c6edc7b04d 100644 --- a/hardware_interface/doc/hardware_components_userdoc.rst +++ b/hardware_interface/doc/hardware_components_userdoc.rst @@ -1,3 +1,5 @@ +:github_url: https://github.com/ros-controls/ros2_control/blob/|github_branch|/hardware_interface/doc/hardware_components_userdoc.rst + .. _hardware_components_userdoc: Hardware Components diff --git a/hardware_interface/doc/mock_components_userdoc.rst b/hardware_interface/doc/mock_components_userdoc.rst index 0e74b9fb2d..3fbc1c4a14 100644 --- a/hardware_interface/doc/mock_components_userdoc.rst +++ b/hardware_interface/doc/mock_components_userdoc.rst @@ -1,3 +1,5 @@ +:github_url: https://github.com/ros-controls/ros2_control/blob/|github_branch|/hardware_interface/doc/mock_components_userdoc.rst + .. _mock_components_userdoc: Mock Components diff --git a/hardware_interface/doc/writing_new_hardware_interface.rst b/hardware_interface/doc/writing_new_hardware_interface.rst index fb748359eb..a5ece92560 100644 --- a/hardware_interface/doc/writing_new_hardware_interface.rst +++ b/hardware_interface/doc/writing_new_hardware_interface.rst @@ -1,3 +1,5 @@ +:github_url: https://github.com/ros-controls/ros2_control/blob/|github_branch|/hardware_interface/doc/writing_new_hardware_interface.rst + .. _writing_new_hardware_interface: Writing a new hardware interface diff --git a/ros2controlcli/doc/userdoc.rst b/ros2controlcli/doc/userdoc.rst index 6ae26df325..c608c3a3de 100644 --- a/ros2controlcli/doc/userdoc.rst +++ b/ros2controlcli/doc/userdoc.rst @@ -1,3 +1,5 @@ +:github_url: https://github.com/ros-controls/ros2_control/blob/|github_branch|/ros2controlcli/doc/userdoc.rst + .. _ros2controlcli_userdoc: Command Line Interface From 0eb319ea43b78b886ac0907ed005daf413a1dbdb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christoph=20Fr=C3=B6hlich?= Date: Tue, 16 May 2023 13:26:19 +0200 Subject: [PATCH 6/6] Fix GitHub link on control.ros.org (#1022) --- controller_manager/doc/userdoc.rst | 2 ++ 1 file changed, 2 insertions(+) diff --git a/controller_manager/doc/userdoc.rst b/controller_manager/doc/userdoc.rst index b23ed876b4..97d6b6e01d 100644 --- a/controller_manager/doc/userdoc.rst +++ b/controller_manager/doc/userdoc.rst @@ -1,3 +1,5 @@ +:github_url: https://github.com/ros-controls/ros2_control/blob/|github_branch|/controller_manager/doc/userdoc.rst + .. _controller_manager_userdoc: Controller Manager