├── ros2controlcli ├── resource │ └── ros2controlcli ├── ros2controlcli │ ├── __init__.py │ ├── verb │ │ ├── __init__.py │ │ ├── list_controller_types.py │ │ ├── reload_controller_libraries.py │ │ ├── unload_controller.py │ │ └── cleanup_controller.py │ └── command │ │ ├── __init__.py │ │ └── control.py ├── README.rst └── package.xml ├── ros2_control-not-released.humble.repos ├── ros2_control-not-released.jazzy.repos ├── ros2_control-not-released.kilted.repos ├── ros2_control-not-released.rolling.repos ├── rqt_controller_manager ├── resource │ ├── rqt_controller_manager │ ├── cm_icon.png │ ├── led_off.png │ ├── led_cyan.png │ ├── led_green.png │ └── led_yellow.png ├── rqt_controller_manager │ ├── __init__.py │ ├── main.py │ └── update_combo.py ├── setup.cfg ├── plugin.xml ├── setup.py └── package.xml ├── doc ├── images │ ├── plotjuggler.png │ ├── plotjuggler_select_topics.png │ └── plotjuggler_visualizing_data.png └── index.rst ├── controller_manager_msgs ├── msg │ ├── HardwareInterface.msg │ ├── ChainConnection.msg │ ├── NamedLifecycleState.msg │ ├── ControllerManagerActivity.msg │ ├── HardwareComponentState.msg │ └── ControllerState.msg ├── srv │ ├── ListHardwareInterfaces.srv │ ├── ListControllerTypes.srv │ ├── ListControllers.srv │ ├── ListHardwareComponents.srv │ ├── UnloadController.srv │ ├── CleanupController.srv │ ├── LoadController.srv │ ├── ConfigureController.srv │ ├── ReloadControllerLibraries.srv │ └── SetHardwareComponentState.srv ├── CMakeLists.txt └── package.xml ├── ros2_control ├── CMakeLists.txt ├── doc │ ├── conf.py │ └── index.rst ├── rosdoc2.yaml └── package.xml ├── controller_manager ├── doc │ └── images │ │ ├── chaining_example2.png │ │ ├── global_general_remap.png │ │ ├── global_specific_remap.png │ │ └── rqt_controller_manager.png ├── test │ ├── test_controller_overriding_parameters.yaml │ ├── test_ros2_control_node.yaml │ ├── test_controller_spawner_wildcard_entries.yaml │ ├── test_controller_spawner_wildcard_entries_global.yaml │ ├── test_controller │ │ └── test_controller.xml │ ├── test_controller_spawner_with_fallback_controllers.yaml │ ├── test_controller_failed_init │ │ ├── test_controller_failed_init.xml │ │ └── test_controller_failed_init.cpp │ ├── test_controller_failed_activate │ │ └── test_controller_failed_activate.xml │ ├── test_controller_with_interfaces │ │ └── test_controller_with_interfaces.xml │ ├── test_chainable_controller │ │ └── test_chainable_controller.xml │ ├── test_controller_spawner_with_interfaces.yaml │ └── test_controller_spawner_with_type.yaml ├── setup.cfg ├── controller_manager │ └── __init__.py └── include │ └── controller_manager │ └── controller_spec.hpp ├── transmission_interface ├── images │ ├── simple_transmission.png │ ├── differential_transmission.png │ ├── simple_transmission_gears.png │ ├── four_bar_linkage_transmission.png │ └── simple_transmission_timing_belt.png ├── doc │ ├── conf.py │ └── index.rst ├── ros2_control_plugins.xml ├── package.xml ├── include │ └── transmission_interface │ │ ├── exception.hpp │ │ ├── transmission_interface_exception.hpp │ │ ├── simple_transmission_loader.hpp │ │ ├── differential_transmission_loader.hpp │ │ ├── four_bar_linkage_transmission_loader.hpp │ │ ├── transmission_loader.hpp │ │ └── accessor.hpp ├── test │ ├── utils_test.cpp │ └── random_generator_utils.hpp └── src │ ├── simple_transmission_loader.cpp │ ├── differential_transmission_loader.cpp │ └── four_bar_linkage_transmission_loader.cpp ├── controller_interface ├── test │ ├── test_controller_node_options.yaml │ ├── test_controller_tf_prefix.hpp │ ├── test_controller_tf_prefix.cpp │ ├── test_pose_sensor.hpp │ ├── test_led_rgb_device.hpp │ ├── test_magnetic_field_sensor.hpp │ ├── test_semantic_component_command_interface.hpp │ └── test_controller_interface.hpp ├── src │ └── controller_interface.cpp ├── package.xml └── include │ ├── controller_interface │ ├── tf_prefix.hpp │ └── controller_interface.hpp │ └── semantic_components │ └── range_sensor.hpp ├── hardware_interface_testing ├── README.md ├── package.xml ├── test │ └── test_components │ │ └── test_components.xml └── CMakeLists.txt ├── hardware_interface ├── README.md ├── mock_components_plugin_description.xml ├── include │ └── hardware_interface │ │ ├── types │ │ ├── trigger_type.hpp │ │ ├── lifecycle_state_names.hpp │ │ ├── hardware_interface_return_values.hpp │ │ └── hardware_component_interface_params.hpp │ │ ├── sensor.hpp │ │ ├── system.hpp │ │ ├── actuator.hpp │ │ ├── lifecycle_helpers.hpp │ │ └── controller_info.hpp ├── test │ ├── test_inst_hardwares.cpp │ ├── test_components.hpp │ ├── test_hardware_components │ │ └── test_hardware_components.xml │ └── test_macros.cpp └── package.xml ├── ros2_control.humble.repos ├── .docker ├── release │ └── Dockerfile └── source │ └── Dockerfile ├── .clang-format ├── .github ├── workflows │ ├── reviewer_lottery.yml │ ├── rosdoc2.yml │ ├── update-pre-commit.yml │ ├── jazzy-pre-commit.yml │ ├── humble-pre-commit.yml │ ├── kilted-pre-commit.yml │ ├── rolling-pre-commit.yml │ ├── jazzy-coverage-build.yml │ ├── kilted-coverage-build.yml │ ├── jazzy-check-docs.yml │ ├── humble-check-docs.yml │ ├── kilted-check-docs.yml │ ├── rolling-check-docs.yml │ ├── jazzy-abi-compatibility.yml │ ├── humble-abi-compatibility.yml │ ├── kilted-abi-compatibility.yml │ ├── jazzy-source-build.yml │ ├── humble-source-build.yml │ ├── kilted-source-build.yml │ ├── humble-coverage-build.yml │ ├── rolling-coverage-build.yml │ ├── kilted-pre-release.yml │ ├── rolling-abi-compatibility.yml │ ├── rolling-source-build.yml │ ├── rolling-semi-binary-build-win.yml │ ├── humble-debian-build.yml │ ├── rolling-compatibility-jazzy-binary-build.yml │ ├── rolling-compatibility-humble-binary-build.yml │ ├── rolling-compatibility-kilted-binary-build.yml │ ├── jazzy-debian-build.yml │ ├── kilted-debian-build.yml │ ├── jazzy-rhel-binary-build.yml │ ├── stale.yml │ ├── humble-rhel-binary-build.yml │ ├── kilted-rhel-binary-build.yml │ ├── rolling-debian-build.yml │ ├── rolling-rhel-binary-build.yml │ ├── jazzy-semi-binary-downstream-build.yml │ ├── humble-semi-binary-downstream-build.yml │ ├── kilted-semi-binary-downstream-build.yml │ ├── rolling-semi-binary-downstream-build.yml │ ├── jazzy-binary-build.yml │ ├── humble-binary-build.yml │ ├── kilted-binary-build.yml │ ├── rolling-binary-build.yml │ ├── jazzy-semi-binary-build.yml │ ├── kilted-semi-binary-build.yml │ ├── jazzy-pre-release.yml │ ├── humble-pre-release.yml │ ├── humble-semi-binary-build.yml │ ├── rolling-pre-release.yml │ └── rolling-semi-binary-build.yml ├── dependabot.yml └── mergify.yml ├── ros2_control.jazzy.repos ├── ros2_control.kilted.repos ├── ros2_control.rolling.repos ├── codecov.yml ├── ros_controls.jazzy.repos ├── ros_controls.kilted.repos ├── ros_controls.rolling.repos ├── ros2_control_test_assets ├── package.xml ├── CMakeLists.txt └── include │ └── ros2_control_test_assets │ └── test_hardware_interface_constants.hpp ├── joint_limits ├── src │ └── joint_limiter_interface.cpp ├── joint_limiters.xml ├── package.xml └── test │ ├── joint_saturation_limiter_param.yaml │ └── joint_limits_rosparam.launch.py └── ros_controls.humble.repos /ros2controlcli/resource/ros2controlcli: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /ros2controlcli/ros2controlcli/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /ros2controlcli/ros2controlcli/verb/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /ros2controlcli/ros2controlcli/command/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /ros2_control-not-released.humble.repos: -------------------------------------------------------------------------------- 1 | repositories: 2 | -------------------------------------------------------------------------------- /ros2_control-not-released.jazzy.repos: -------------------------------------------------------------------------------- 1 | repositories: 2 | -------------------------------------------------------------------------------- /ros2_control-not-released.kilted.repos: -------------------------------------------------------------------------------- 1 | repositories: 2 | -------------------------------------------------------------------------------- /ros2_control-not-released.rolling.repos: -------------------------------------------------------------------------------- 1 | repositories: 2 | -------------------------------------------------------------------------------- /rqt_controller_manager/resource/rqt_controller_manager: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /rqt_controller_manager/rqt_controller_manager/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /doc/images/plotjuggler.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ros-controls/ros2_control/HEAD/doc/images/plotjuggler.png -------------------------------------------------------------------------------- /controller_manager_msgs/msg/HardwareInterface.msg: -------------------------------------------------------------------------------- 1 | string name 2 | string data_type 3 | bool is_available 4 | bool is_claimed 5 | -------------------------------------------------------------------------------- /doc/images/plotjuggler_select_topics.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ros-controls/ros2_control/HEAD/doc/images/plotjuggler_select_topics.png -------------------------------------------------------------------------------- /doc/images/plotjuggler_visualizing_data.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ros-controls/ros2_control/HEAD/doc/images/plotjuggler_visualizing_data.png -------------------------------------------------------------------------------- /rqt_controller_manager/resource/cm_icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ros-controls/ros2_control/HEAD/rqt_controller_manager/resource/cm_icon.png -------------------------------------------------------------------------------- /rqt_controller_manager/resource/led_off.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ros-controls/ros2_control/HEAD/rqt_controller_manager/resource/led_off.png -------------------------------------------------------------------------------- /controller_manager_msgs/srv/ListHardwareInterfaces.srv: -------------------------------------------------------------------------------- 1 | 2 | --- 3 | HardwareInterface[] command_interfaces 4 | HardwareInterface[] state_interfaces 5 | -------------------------------------------------------------------------------- /rqt_controller_manager/resource/led_cyan.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ros-controls/ros2_control/HEAD/rqt_controller_manager/resource/led_cyan.png -------------------------------------------------------------------------------- /rqt_controller_manager/resource/led_green.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ros-controls/ros2_control/HEAD/rqt_controller_manager/resource/led_green.png -------------------------------------------------------------------------------- /rqt_controller_manager/resource/led_yellow.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ros-controls/ros2_control/HEAD/rqt_controller_manager/resource/led_yellow.png -------------------------------------------------------------------------------- /ros2_control/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.16) 2 | project(ros2_control) 3 | 4 | find_package(ament_cmake REQUIRED) 5 | ament_package() 6 | -------------------------------------------------------------------------------- /controller_manager/doc/images/chaining_example2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ros-controls/ros2_control/HEAD/controller_manager/doc/images/chaining_example2.png -------------------------------------------------------------------------------- /rqt_controller_manager/setup.cfg: -------------------------------------------------------------------------------- 1 | [develop] 2 | script_dir=$base/lib/rqt_controller_manager 3 | [install] 4 | install_scripts=$base/lib/rqt_controller_manager 5 | -------------------------------------------------------------------------------- /transmission_interface/images/simple_transmission.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ros-controls/ros2_control/HEAD/transmission_interface/images/simple_transmission.png -------------------------------------------------------------------------------- /controller_manager/doc/images/global_general_remap.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ros-controls/ros2_control/HEAD/controller_manager/doc/images/global_general_remap.png -------------------------------------------------------------------------------- /controller_manager/doc/images/global_specific_remap.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ros-controls/ros2_control/HEAD/controller_manager/doc/images/global_specific_remap.png -------------------------------------------------------------------------------- /controller_manager/doc/images/rqt_controller_manager.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ros-controls/ros2_control/HEAD/controller_manager/doc/images/rqt_controller_manager.png -------------------------------------------------------------------------------- /transmission_interface/images/differential_transmission.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ros-controls/ros2_control/HEAD/transmission_interface/images/differential_transmission.png -------------------------------------------------------------------------------- /transmission_interface/images/simple_transmission_gears.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ros-controls/ros2_control/HEAD/transmission_interface/images/simple_transmission_gears.png -------------------------------------------------------------------------------- /transmission_interface/images/four_bar_linkage_transmission.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ros-controls/ros2_control/HEAD/transmission_interface/images/four_bar_linkage_transmission.png -------------------------------------------------------------------------------- /ros2controlcli/README.rst: -------------------------------------------------------------------------------- 1 | Read the `Docs`_ for example usage and command line arguments. 2 | 3 | .. _Docs: https://control.ros.org/master/doc/ros2_control/ros2controlcli/doc/userdoc.html 4 | -------------------------------------------------------------------------------- /transmission_interface/images/simple_transmission_timing_belt.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ros-controls/ros2_control/HEAD/transmission_interface/images/simple_transmission_timing_belt.png -------------------------------------------------------------------------------- /controller_manager_msgs/msg/ChainConnection.msg: -------------------------------------------------------------------------------- 1 | string name # name of controller exporting reference_interfaces 2 | string[] reference_interfaces # list of reference exported by controller 3 | -------------------------------------------------------------------------------- /controller_interface/test/test_controller_node_options.yaml: -------------------------------------------------------------------------------- 1 | controller_name: 2 | ros__parameters: 3 | parameter_list: 4 | parameter1: 20.0 5 | parameter2: 23.14 6 | parameter3: -52.323 7 | -------------------------------------------------------------------------------- /hardware_interface_testing/README.md: -------------------------------------------------------------------------------- 1 | # hardware_interface_testing 2 | 3 | This package contains a set of hardware interfaces and controllers that can be used for other 4 | packages to test their functionality. 5 | -------------------------------------------------------------------------------- /controller_manager/test/test_controller_overriding_parameters.yaml: -------------------------------------------------------------------------------- 1 | ctrl_with_parameters_and_type: 2 | ros__parameters: 3 | interface_name: "impedance" 4 | joint_offset: 0.2 5 | joint_names: ["joint10"] 6 | -------------------------------------------------------------------------------- /controller_manager_msgs/srv/ListControllerTypes.srv: -------------------------------------------------------------------------------- 1 | # The ListControllers service returns a list of controller types that are known 2 | # to the controller manager plugin mechanism. 3 | 4 | --- 5 | string[] types 6 | string[] base_classes 7 | -------------------------------------------------------------------------------- /controller_manager/setup.cfg: -------------------------------------------------------------------------------- 1 | [options.entry_points] 2 | console_scripts = 3 | spawner = controller_manager.spawner:main 4 | unspawner = controller_manager.unspawner:main 5 | hardware_spawner = controller_manager.hardware_spawner:main 6 | -------------------------------------------------------------------------------- /controller_manager_msgs/srv/ListControllers.srv: -------------------------------------------------------------------------------- 1 | # The ListControllers service returns a list of controller names/states/types of the 2 | # controllers that are loaded inside the controller_manager. 3 | 4 | --- 5 | controller_manager_msgs/ControllerState[] controller 6 | -------------------------------------------------------------------------------- /controller_manager/test/test_ros2_control_node.yaml: -------------------------------------------------------------------------------- 1 | controller_manager: 2 | ros__parameters: 3 | update_rate: 100 # Hz 4 | 5 | ctrl_with_parameters_and_type: 6 | ros__parameters: 7 | type: "controller_manager/test_controller" 8 | joint_names: ["joint1"] 9 | -------------------------------------------------------------------------------- /hardware_interface/README.md: -------------------------------------------------------------------------------- 1 | # Overview 2 | 3 | For detailed information about this package, please see the [ros2_control Documentation]! 4 | 5 | [ros2_control Documentation]: https://control.ros.org/master/doc/ros2_control/hardware_interface/doc/hardware_components_userdoc.html 6 | -------------------------------------------------------------------------------- /controller_manager/test/test_controller_spawner_wildcard_entries.yaml: -------------------------------------------------------------------------------- 1 | /**: 2 | ros__parameters: 3 | type: "controller_manager/test_controller" 4 | joint_names: ["joint1"] 5 | param1: 1.0 6 | param2: 2.0 7 | 8 | wildcard_ctrl_3: 9 | ros__parameters: 10 | param3: 3.0 11 | -------------------------------------------------------------------------------- /ros2_control.humble.repos: -------------------------------------------------------------------------------- 1 | repositories: 2 | realtime_tools: 3 | type: git 4 | url: https://github.com/ros-controls/realtime_tools.git 5 | version: humble 6 | control_msgs: 7 | type: git 8 | url: https://github.com/ros-controls/control_msgs.git 9 | version: humble 10 | -------------------------------------------------------------------------------- /ros2_control/doc/conf.py: -------------------------------------------------------------------------------- 1 | # Configuration file for the Sphinx documentation builder. 2 | # settings will be overridden by rosdoc2, so we add here only custom settings 3 | 4 | copyright = "2024, ros2_control development team" 5 | html_logo = "https://control.ros.org/master/_static/logo_ros-controls.png" 6 | -------------------------------------------------------------------------------- /controller_manager/test/test_controller_spawner_wildcard_entries_global.yaml: -------------------------------------------------------------------------------- 1 | /**: 2 | ros__parameters: 3 | joint_names: ["joint1"] 4 | param1: 1.0 5 | param2: 2.0 6 | 7 | wildcard_ctrl: 8 | ros__parameters: 9 | type: "controller_manager/test_controller" 10 | param3: 3.0 11 | -------------------------------------------------------------------------------- /transmission_interface/doc/conf.py: -------------------------------------------------------------------------------- 1 | # Configuration file for the Sphinx documentation builder. 2 | # settings will be overridden by rosdoc2, so we add here only custom settings 3 | 4 | copyright = "2024, ros2_control development team" 5 | html_logo = "https://control.ros.org/master/_static/logo_ros-controls.png" 6 | -------------------------------------------------------------------------------- /controller_manager_msgs/srv/ListHardwareComponents.srv: -------------------------------------------------------------------------------- 1 | # The ListHardwareComponents service returns a list of hardware HardwareComponentsState. 2 | # This will convey name, component_type, state and type of the components 3 | # that are loaded inside the resource_manager. 4 | 5 | --- 6 | HardwareComponentState[] component 7 | -------------------------------------------------------------------------------- /.docker/release/Dockerfile: -------------------------------------------------------------------------------- 1 | ARG ROS_DISTRO="humble" 2 | FROM ros:${ROS_DISTRO} 3 | 4 | # Commands are combined in single RUN statement with "apt/lists" folder removal to reduce image size 5 | RUN apt-get update && \ 6 | apt-get install -y ros-${ROS_DISTRO}-ros2-control ros-${ROS_DISTRO}-ros2-controllers && \ 7 | rm -rf /var/lib/apt/lists/* 8 | -------------------------------------------------------------------------------- /controller_manager_msgs/msg/NamedLifecycleState.msg: -------------------------------------------------------------------------------- 1 | # This message is used to provide information about the lifecycle state of the controller or the hardware components 2 | 3 | # The name of the controller or hardware interface 4 | string name 5 | 6 | # The current lifecycle state of the controller or hardware components 7 | lifecycle_msgs/State state 8 | -------------------------------------------------------------------------------- /controller_manager_msgs/srv/UnloadController.srv: -------------------------------------------------------------------------------- 1 | # The UnloadController service allows you to unload a single controller 2 | # from controller_manager 3 | 4 | # To unload a controller, specify the "name" of the controller. 5 | # The return value "ok" indicates if the controller was successfully 6 | # unloaded or not 7 | 8 | string name 9 | --- 10 | bool ok 11 | -------------------------------------------------------------------------------- /controller_manager_msgs/srv/CleanupController.srv: -------------------------------------------------------------------------------- 1 | # The CleanupController service allows you to cleanup a single controller 2 | # from controller_manager 3 | 4 | # To cleanup a controller, specify the "name" of the controller. 5 | # The return value "ok" indicates if the controller was successfully 6 | # cleaned up or not 7 | 8 | string name 9 | --- 10 | bool ok 11 | -------------------------------------------------------------------------------- /controller_manager/test/test_controller/test_controller.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Controller used for testing 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /controller_manager_msgs/srv/LoadController.srv: -------------------------------------------------------------------------------- 1 | # The LoadController service allows you to load a single controller 2 | # inside controller_manager 3 | 4 | # To load a controller, specify the "name" of the controller. 5 | # The return value "ok" indicates if the controller was successfully 6 | # constructed and initialized or not. 7 | 8 | string name 9 | --- 10 | bool ok 11 | -------------------------------------------------------------------------------- /controller_manager_msgs/srv/ConfigureController.srv: -------------------------------------------------------------------------------- 1 | # The ConfigureController service allows you to configure a single controller 2 | # inside controller_manager 3 | 4 | # To configure a controller, specify the "name" of the controller. 5 | # The return value "ok" indicates if the controller was successfully 6 | # configured or not. 7 | 8 | string name 9 | --- 10 | bool ok 11 | -------------------------------------------------------------------------------- /hardware_interface/mock_components_plugin_description.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Generic components for simple mocking of system hardware. 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /controller_manager/test/test_controller_spawner_with_fallback_controllers.yaml: -------------------------------------------------------------------------------- 1 | ctrl_1: 2 | ros__parameters: 3 | joint_names: ["joint1"] 4 | 5 | ctrl_2: 6 | ros__parameters: 7 | joint_names: ["joint2"] 8 | fallback_controllers: ["ctrl_6", "ctrl_7", "ctrl_8"] 9 | 10 | ctrl_3: 11 | ros__parameters: 12 | joint_names: ["joint3"] 13 | fallback_controllers: ["ctrl_9"] 14 | -------------------------------------------------------------------------------- /.clang-format: -------------------------------------------------------------------------------- 1 | --- 2 | Language: Cpp 3 | BasedOnStyle: Google 4 | 5 | ColumnLimit: 100 6 | AccessModifierOffset: -2 7 | AlignAfterOpenBracket: AlwaysBreak 8 | BreakBeforeBraces: Allman 9 | ConstructorInitializerIndentWidth: 0 10 | ContinuationIndentWidth: 2 11 | DerivePointerAlignment: false 12 | PointerAlignment: Middle 13 | ReflowComments: true 14 | IncludeBlocks: Preserve 15 | InsertBraces: true 16 | ... 17 | -------------------------------------------------------------------------------- /.github/workflows/reviewer_lottery.yml: -------------------------------------------------------------------------------- 1 | name: Reviewer lottery 2 | # pull_request_target takes the same events as pull_request, 3 | # but it runs on the base branch instead of the head branch. 4 | on: 5 | pull_request_target: 6 | types: [opened, ready_for_review, reopened] 7 | 8 | jobs: 9 | assign_reviewers: 10 | uses: ros-controls/ros2_control_ci/.github/workflows/reusable-reviewer-lottery.yml@master 11 | -------------------------------------------------------------------------------- /ros2_control.jazzy.repos: -------------------------------------------------------------------------------- 1 | repositories: 2 | realtime_tools: 3 | type: git 4 | url: https://github.com/ros-controls/realtime_tools.git 5 | version: jazzy 6 | control_msgs: 7 | type: git 8 | url: https://github.com/ros-controls/control_msgs.git 9 | version: jazzy 10 | ros2_control_cmake: 11 | type: git 12 | url: https://github.com/ros-controls/ros2_control_cmake.git 13 | version: master 14 | -------------------------------------------------------------------------------- /ros2_control.kilted.repos: -------------------------------------------------------------------------------- 1 | repositories: 2 | realtime_tools: 3 | type: git 4 | url: https://github.com/ros-controls/realtime_tools.git 5 | version: kilted 6 | control_msgs: 7 | type: git 8 | url: https://github.com/ros-controls/control_msgs.git 9 | version: master 10 | ros2_control_cmake: 11 | type: git 12 | url: https://github.com/ros-controls/ros2_control_cmake.git 13 | version: master 14 | -------------------------------------------------------------------------------- /ros2_control.rolling.repos: -------------------------------------------------------------------------------- 1 | repositories: 2 | realtime_tools: 3 | type: git 4 | url: https://github.com/ros-controls/realtime_tools.git 5 | version: master 6 | control_msgs: 7 | type: git 8 | url: https://github.com/ros-controls/control_msgs.git 9 | version: master 10 | ros2_control_cmake: 11 | type: git 12 | url: https://github.com/ros-controls/ros2_control_cmake.git 13 | version: master 14 | -------------------------------------------------------------------------------- /controller_manager/test/test_controller_failed_init/test_controller_failed_init.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Controller used for testing 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /.github/workflows/rosdoc2.yml: -------------------------------------------------------------------------------- 1 | name: rosdoc2 2 | 3 | on: 4 | workflow_dispatch: 5 | pull_request: 6 | paths: 7 | - ros2_control/doc/** 8 | - ros2_control/rosdoc2.yaml 9 | - ros2_control/package.xml 10 | 11 | concurrency: 12 | group: ${{ github.workflow }}-${{ github.ref }} 13 | cancel-in-progress: true 14 | 15 | jobs: 16 | check: 17 | uses: ros-controls/ros2_control_ci/.github/workflows/reusable-rosdoc2.yml@master 18 | -------------------------------------------------------------------------------- /controller_manager/test/test_controller_failed_activate/test_controller_failed_activate.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Controller used for testing 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /controller_manager/test/test_controller_with_interfaces/test_controller_with_interfaces.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Controller used for testing 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /controller_manager/test/test_chainable_controller/test_chainable_controller.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 6 | 7 | Controller used for testing 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /.github/workflows/update-pre-commit.yml: -------------------------------------------------------------------------------- 1 | name: Auto Update pre-commit 2 | # Update pre-commit config and create PR if changes are detected 3 | # author: Christoph Fröhlich 4 | 5 | on: 6 | workflow_dispatch: 7 | schedule: 8 | - cron: '0 0 1 * *' # Runs at 00:00, on day 1 of the month 9 | 10 | jobs: 11 | auto_update_and_create_pr: 12 | uses: ros-controls/ros2_control_ci/.github/workflows/reusable-update-pre-commit.yml@master 13 | -------------------------------------------------------------------------------- /controller_manager_msgs/msg/ControllerManagerActivity.msg: -------------------------------------------------------------------------------- 1 | # This message is used to provide the activity within the controller manager regarding the change in state of controllers and hardware interfaces 2 | 3 | # The header is used to provide timestamp information 4 | std_msgs/Header header 5 | 6 | # The current state of the controllers 7 | NamedLifecycleState[] controllers 8 | 9 | # The current state of the hardware components 10 | NamedLifecycleState[] hardware_components 11 | -------------------------------------------------------------------------------- /.github/workflows/jazzy-pre-commit.yml: -------------------------------------------------------------------------------- 1 | name: Pre-Commit - Jazzy 2 | 3 | on: 4 | workflow_dispatch: 5 | pull_request: 6 | branches: 7 | - jazzy 8 | push: 9 | branches: 10 | - jazzy 11 | 12 | concurrency: 13 | group: ${{ github.workflow }}-${{ github.ref }} 14 | cancel-in-progress: true 15 | 16 | jobs: 17 | pre-commit: 18 | uses: ros-controls/ros2_control_ci/.github/workflows/reusable-pre-commit.yml@master 19 | with: 20 | ros_distro: jazzy 21 | -------------------------------------------------------------------------------- /.github/workflows/humble-pre-commit.yml: -------------------------------------------------------------------------------- 1 | name: Pre-Commit - Humble 2 | 3 | on: 4 | workflow_dispatch: 5 | pull_request: 6 | branches: 7 | - humble 8 | push: 9 | branches: 10 | - humble 11 | 12 | concurrency: 13 | group: ${{ github.workflow }}-${{ github.ref }} 14 | cancel-in-progress: true 15 | 16 | jobs: 17 | pre-commit: 18 | uses: ros-controls/ros2_control_ci/.github/workflows/reusable-pre-commit.yml@master 19 | with: 20 | ros_distro: humble 21 | -------------------------------------------------------------------------------- /.github/workflows/kilted-pre-commit.yml: -------------------------------------------------------------------------------- 1 | name: Pre-Commit - Kilted 2 | 3 | on: 4 | workflow_dispatch: 5 | pull_request: 6 | branches: 7 | - kilted 8 | push: 9 | branches: 10 | - kilted 11 | 12 | concurrency: 13 | group: ${{ github.workflow }}-${{ github.ref }} 14 | cancel-in-progress: true 15 | 16 | jobs: 17 | pre-commit: 18 | uses: ros-controls/ros2_control_ci/.github/workflows/reusable-pre-commit.yml@master 19 | with: 20 | ros_distro: kilted 21 | -------------------------------------------------------------------------------- /controller_manager_msgs/srv/ReloadControllerLibraries.srv: -------------------------------------------------------------------------------- 1 | # The ReloadControllerLibraries service will reload all controllers that are available in 2 | # the system as plugins 3 | 4 | # Reloading libraries only works if there are no controllers loaded. If there 5 | # are still some controllers loaded, the reloading will fail. 6 | # If this bool is set to true, all loaded controllers will get 7 | # killed automatically, and the reloading can succeed. 8 | bool force_kill 9 | --- 10 | bool ok 11 | -------------------------------------------------------------------------------- /ros2_control/rosdoc2.yaml: -------------------------------------------------------------------------------- 1 | type: 'rosdoc2 config' 2 | version: 1 3 | 4 | --- 5 | 6 | settings: 7 | # Not generating any documentation of code 8 | generate_package_index: false 9 | always_run_doxygen: false 10 | enable_breathe: false 11 | enable_exhale: false 12 | always_run_sphinx_apidoc: false 13 | 14 | builders: 15 | # Configure Sphinx with the location of the docs: 16 | - sphinx: { 17 | name: 'ros2_control', 18 | sphinx_sourcedir: 'doc', 19 | output_dir: '' 20 | } 21 | -------------------------------------------------------------------------------- /codecov.yml: -------------------------------------------------------------------------------- 1 | coverage: 2 | precision: 2 3 | round: down 4 | range: "35...100" 5 | status: 6 | project: 7 | default: 8 | informational: true 9 | flags: 10 | - unittests 11 | patch: off 12 | fixes: 13 | - "ros_ws/src/ros2_control/::" 14 | comment: 15 | layout: "diff, flags, files" 16 | behavior: default 17 | flags: 18 | unittests: 19 | paths: 20 | - controller_interface 21 | - controller_manager 22 | - hardware_interface 23 | - joint_limits 24 | - transmission_interface 25 | -------------------------------------------------------------------------------- /controller_manager_msgs/msg/HardwareComponentState.msg: -------------------------------------------------------------------------------- 1 | string name # Name of the hardware component 2 | string type # Type of the hardware component 3 | bool is_async # If the hardware component is running asynchronously 4 | uint16 rw_rate # read/write rate of the hardware component in Hz 5 | string plugin_name # The name of the plugin that is used to load the hardware component 6 | lifecycle_msgs/State state # State of the hardware component 7 | HardwareInterface[] command_interfaces # Command interfaces of the hardware component 8 | HardwareInterface[] state_interfaces # State interfaces of the hardware component 9 | -------------------------------------------------------------------------------- /.github/workflows/rolling-pre-commit.yml: -------------------------------------------------------------------------------- 1 | name: Pre-Commit - Rolling 2 | 3 | on: 4 | workflow_dispatch: 5 | pull_request: 6 | branches: 7 | - master 8 | push: 9 | branches: 10 | - master 11 | 12 | concurrency: 13 | group: ${{ github.workflow }}-${{ github.ref }} 14 | cancel-in-progress: true 15 | 16 | jobs: 17 | pre-commit: 18 | uses: ros-controls/ros2_control_ci/.github/workflows/reusable-pre-commit.yml@master 19 | strategy: 20 | fail-fast: false 21 | matrix: 22 | ROS_DISTRO: [rolling] 23 | with: 24 | ros_distro: ${{ matrix.ROS_DISTRO }} 25 | -------------------------------------------------------------------------------- /.github/workflows/jazzy-coverage-build.yml: -------------------------------------------------------------------------------- 1 | name: Coverage Build - Jazzy 2 | on: 3 | workflow_dispatch: 4 | pull_request: &event 5 | branches: 6 | - jazzy 7 | paths: 8 | - '**.hpp' 9 | - '**.h' 10 | - '**.cpp' 11 | - '**.py' 12 | - '**.yaml' 13 | - '.github/workflows/jazzy-coverage-build.yml' 14 | - '**/package.xml' 15 | - '**/CMakeLists.txt' 16 | - 'ros2_control.jazzy.repos' 17 | - 'codecov.yml' 18 | push: *event 19 | 20 | jobs: 21 | coverage_jazzy: 22 | uses: ros-controls/ros2_control_ci/.github/workflows/reusable-build-coverage.yml@master 23 | secrets: inherit 24 | with: 25 | ros_distro: jazzy 26 | -------------------------------------------------------------------------------- /transmission_interface/doc/index.rst: -------------------------------------------------------------------------------- 1 | Welcome to the documentation for transmission_interface 2 | ======================================================= 3 | 4 | ``transmission_interface`` contains data structures for representing mechanical transmissions, methods for propagating values between actuator and joint spaces and tooling to support this. 5 | 6 | For more information of the ros2_control framework see `control.ros.org `__. 7 | 8 | API documentation 9 | ------------------ 10 | 11 | .. toctree:: 12 | :maxdepth: 2 13 | 14 | C++ API 15 | 16 | 17 | Indices and Search 18 | ================== 19 | 20 | * :ref:`genindex` 21 | * :ref:`search` 22 | -------------------------------------------------------------------------------- /.github/workflows/kilted-coverage-build.yml: -------------------------------------------------------------------------------- 1 | name: Coverage Build - Kilted 2 | on: 3 | workflow_dispatch: 4 | pull_request: &event 5 | branches: 6 | - kilted 7 | paths: 8 | - '**.hpp' 9 | - '**.h' 10 | - '**.cpp' 11 | - '**.py' 12 | - '**.yaml' 13 | - '.github/workflows/kilted-coverage-build.yml' 14 | - '**/package.xml' 15 | - '**/CMakeLists.txt' 16 | - 'ros2_control.kilted.repos' 17 | - 'codecov.yml' 18 | push: *event 19 | 20 | jobs: 21 | coverage_kilted: 22 | uses: ros-controls/ros2_control_ci/.github/workflows/reusable-build-coverage.yml@master 23 | secrets: inherit 24 | with: 25 | ros_distro: kilted 26 | -------------------------------------------------------------------------------- /.docker/source/Dockerfile: -------------------------------------------------------------------------------- 1 | ARG ROS_DISTRO="rolling" 2 | FROM ros:$ROS_DISTRO 3 | ARG BRANCH="master" 4 | 5 | ENV ROS_UNDERLAY /root/ws_ros2_control/install 6 | WORKDIR $ROS_UNDERLAY/../src 7 | 8 | ADD https://raw.githubusercontent.com/ros-controls/ros2_control/$BRANCH/ros2_control.$ROS_DISTRO.repos ros2_control.repos 9 | RUN vcs import < ros2_control.repos 10 | 11 | RUN apt-get update && rosdep update && \ 12 | rosdep install -iy --from-paths . && \ 13 | rm -rf /var/lib/apt/lists/ 14 | 15 | RUN cd $ROS_UNDERLAY/.. && \ 16 | . /opt/ros/${ROS_DISTRO}/setup.sh && \ 17 | colcon build 18 | 19 | # source entrypoint setup 20 | RUN sed --in-place --expression \ 21 | '$isource "$ROS_UNDERLAY/setup.bash"' \ 22 | /ros_entrypoint.sh 23 | -------------------------------------------------------------------------------- /rqt_controller_manager/plugin.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | Graphical frontend for interacting with the controller manager. 7 | 8 | 9 | 10 | 11 | folder 12 | Plugins related to robot tools. 13 | 14 | 15 | resource/cm_icon.png 16 | Interact with controller managers 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /.github/workflows/jazzy-check-docs.yml: -------------------------------------------------------------------------------- 1 | name: Jazzy Check Docs 2 | 3 | on: 4 | workflow_dispatch: 5 | pull_request: 6 | branches: 7 | - jazzy 8 | paths: 9 | - '**.rst' 10 | - '**.md' 11 | - '**.jpg' 12 | - '**.jpeg' 13 | - '**.png' 14 | - '**.svg' 15 | - '**.yml' 16 | - '**.yaml' 17 | - '!.github/**' # exclude yaml files in .github directory 18 | - '.github/workflows/jazzy-check-docs.yml' 19 | 20 | concurrency: 21 | group: ${{ github.workflow }}-${{ github.ref }} 22 | cancel-in-progress: true 23 | 24 | jobs: 25 | check-docs: 26 | name: Check Docs 27 | uses: ros-controls/control.ros.org/.github/workflows/reusable-sphinx-check-single-version.yml@jazzy 28 | with: 29 | ROS2_CONTROL_PR: ${{ github.ref }} 30 | -------------------------------------------------------------------------------- /.github/workflows/humble-check-docs.yml: -------------------------------------------------------------------------------- 1 | name: Humble Check Docs 2 | 3 | on: 4 | workflow_dispatch: 5 | pull_request: 6 | branches: 7 | - humble 8 | paths: 9 | - '**.rst' 10 | - '**.md' 11 | - '**.jpg' 12 | - '**.jpeg' 13 | - '**.png' 14 | - '**.svg' 15 | - '**.yml' 16 | - '**.yaml' 17 | - '!.github/**' # exclude yaml files in .github directory 18 | - '.github/workflows/humble-check-docs.yml' 19 | 20 | concurrency: 21 | group: ${{ github.workflow }}-${{ github.ref }} 22 | cancel-in-progress: true 23 | 24 | jobs: 25 | check-docs: 26 | name: Check Docs 27 | uses: ros-controls/control.ros.org/.github/workflows/reusable-sphinx-check-single-version.yml@humble 28 | with: 29 | ROS2_CONTROL_PR: ${{ github.ref }} 30 | -------------------------------------------------------------------------------- /.github/workflows/kilted-check-docs.yml: -------------------------------------------------------------------------------- 1 | name: Kilted Check Docs 2 | 3 | on: 4 | workflow_dispatch: 5 | pull_request: 6 | branches: 7 | - kilted 8 | paths: 9 | - '**.rst' 10 | - '**.md' 11 | - '**.jpg' 12 | - '**.jpeg' 13 | - '**.png' 14 | - '**.svg' 15 | - '**.yml' 16 | - '**.yaml' 17 | - '!.github/**' # exclude yaml files in .github directory 18 | - '.github/workflows/kilted-check-docs.yml' 19 | 20 | concurrency: 21 | group: ${{ github.workflow }}-${{ github.ref }} 22 | cancel-in-progress: true 23 | 24 | jobs: 25 | check-docs: 26 | name: Check Docs 27 | uses: ros-controls/control.ros.org/.github/workflows/reusable-sphinx-check-single-version.yml@kilted 28 | with: 29 | ROS2_CONTROL_PR: ${{ github.ref }} 30 | -------------------------------------------------------------------------------- /.github/workflows/rolling-check-docs.yml: -------------------------------------------------------------------------------- 1 | name: Rolling Check Docs 2 | 3 | on: 4 | workflow_dispatch: 5 | pull_request: 6 | branches: 7 | - master 8 | paths: 9 | - '**.rst' 10 | - '**.md' 11 | - '**.jpg' 12 | - '**.jpeg' 13 | - '**.png' 14 | - '**.svg' 15 | - '**.yml' 16 | - '**.yaml' 17 | - '!.github/**' # exclude yaml files in .github directory 18 | - '.github/workflows/rolling-check-docs.yml' 19 | 20 | concurrency: 21 | group: ${{ github.workflow }}-${{ github.ref }} 22 | cancel-in-progress: true 23 | 24 | jobs: 25 | check-docs: 26 | name: Check Docs 27 | uses: ros-controls/control.ros.org/.github/workflows/reusable-sphinx-check-single-version.yml@rolling 28 | with: 29 | ROS2_CONTROL_PR: ${{ github.ref }} 30 | -------------------------------------------------------------------------------- /controller_manager/test/test_controller_spawner_with_interfaces.yaml: -------------------------------------------------------------------------------- 1 | ctrl_with_joint2_command_interface: 2 | ros__parameters: 3 | type: "controller_manager/test_controller" 4 | command_interfaces: 5 | - "joint2/velocity" 6 | 7 | ctrl_with_joint1_command_interface: 8 | ros__parameters: 9 | type: "controller_manager/test_controller" 10 | command_interfaces: 11 | - "joint1/position" 12 | 13 | ctrl_with_joint1_and_joint2_command_interfaces: 14 | ros__parameters: 15 | type: "controller_manager/test_controller" 16 | command_interfaces: 17 | - "joint1/position" 18 | - "joint2/velocity" 19 | 20 | ctrl_with_state_interfaces: 21 | ros__parameters: 22 | type: "controller_manager/test_controller" 23 | state_interfaces: 24 | - "joint1/position" 25 | - "joint2/position" 26 | -------------------------------------------------------------------------------- /ros_controls.jazzy.repos: -------------------------------------------------------------------------------- 1 | repositories: 2 | gz_ros2_control: 3 | type: git 4 | url: https://github.com/ros-controls/gz_ros2_control.git 5 | version: jazzy 6 | ros2_control_demos: 7 | type: git 8 | url: https://github.com/ros-controls/ros2_control_demos.git 9 | version: jazzy 10 | ros2_controllers: 11 | type: git 12 | url: https://github.com/ros-controls/ros2_controllers.git 13 | version: jazzy 14 | control_toolbox: 15 | type: git 16 | url: https://github.com/ros-controls/control_toolbox.git 17 | version: jazzy 18 | kinematics_interface: 19 | type: git 20 | url: https://github.com/ros-controls/kinematics_interface.git 21 | version: jazzy 22 | topic_based_hardware_interfaces: 23 | type: git 24 | url: https://github.com/ros-controls/topic_based_hardware_interfaces.git 25 | version: main 26 | -------------------------------------------------------------------------------- /.github/workflows/jazzy-abi-compatibility.yml: -------------------------------------------------------------------------------- 1 | name: Jazzy - ABI Compatibility Check 2 | on: 3 | workflow_dispatch: 4 | pull_request: 5 | branches: 6 | - jazzy 7 | paths: 8 | - '**.hpp' 9 | - '**.h' 10 | - '**.cpp' 11 | - '**.py' 12 | - '**.yaml' 13 | - '.github/workflows/jazzy-abi-compatibility.yml' 14 | - '**/package.xml' 15 | - '**/CMakeLists.txt' 16 | - 'ros2_control-not-released.jazzy.repos' 17 | 18 | concurrency: 19 | # cancel previous runs of the same workflow, except for pushes on given branches 20 | group: ${{ github.workflow }}-${{ github.ref }} 21 | cancel-in-progress: ${{ !startsWith(github.ref, 'refs/heads') }} 22 | 23 | jobs: 24 | abi_check: 25 | uses: ros-controls/ros2_control_ci/.github/workflows/reusable-abi-check.yml@master 26 | with: 27 | ros_distro: jazzy 28 | -------------------------------------------------------------------------------- /ros_controls.kilted.repos: -------------------------------------------------------------------------------- 1 | repositories: 2 | gz_ros2_control: 3 | type: git 4 | url: https://github.com/ros-controls/gz_ros2_control.git 5 | version: rolling 6 | ros2_control_demos: 7 | type: git 8 | url: https://github.com/ros-controls/ros2_control_demos.git 9 | version: master 10 | ros2_controllers: 11 | type: git 12 | url: https://github.com/ros-controls/ros2_controllers.git 13 | version: kilted 14 | control_toolbox: 15 | type: git 16 | url: https://github.com/ros-controls/control_toolbox.git 17 | version: kilted 18 | kinematics_interface: 19 | type: git 20 | url: https://github.com/ros-controls/kinematics_interface.git 21 | version: master 22 | topic_based_hardware_interfaces: 23 | type: git 24 | url: https://github.com/ros-controls/topic_based_hardware_interfaces.git 25 | version: main 26 | -------------------------------------------------------------------------------- /.github/workflows/humble-abi-compatibility.yml: -------------------------------------------------------------------------------- 1 | name: Humble - ABI Compatibility Check 2 | on: 3 | workflow_dispatch: 4 | pull_request: 5 | branches: 6 | - humble 7 | paths: 8 | - '**.hpp' 9 | - '**.h' 10 | - '**.cpp' 11 | - '**.py' 12 | - '**.yaml' 13 | - '.github/workflows/humble-abi-compatibility.yml' 14 | - '**/package.xml' 15 | - '**/CMakeLists.txt' 16 | - 'ros2_control-not-released.humble.repos' 17 | 18 | concurrency: 19 | # cancel previous runs of the same workflow, except for pushes on given branches 20 | group: ${{ github.workflow }}-${{ github.ref }} 21 | cancel-in-progress: ${{ !startsWith(github.ref, 'refs/heads') }} 22 | 23 | jobs: 24 | abi_check: 25 | uses: ros-controls/ros2_control_ci/.github/workflows/reusable-abi-check.yml@master 26 | with: 27 | ros_distro: humble 28 | -------------------------------------------------------------------------------- /.github/workflows/kilted-abi-compatibility.yml: -------------------------------------------------------------------------------- 1 | name: Kilted - ABI Compatibility Check 2 | on: 3 | workflow_dispatch: 4 | pull_request: 5 | branches: 6 | - kilted 7 | paths: 8 | - '**.hpp' 9 | - '**.h' 10 | - '**.cpp' 11 | - '**.py' 12 | - '**.yaml' 13 | - '.github/workflows/kilted-abi-compatibility.yml' 14 | - '**/package.xml' 15 | - '**/CMakeLists.txt' 16 | - 'ros2_control-not-released.kilted.repos' 17 | 18 | concurrency: 19 | # cancel previous runs of the same workflow, except for pushes on given branches 20 | group: ${{ github.workflow }}-${{ github.ref }} 21 | cancel-in-progress: ${{ !startsWith(github.ref, 'refs/heads') }} 22 | 23 | jobs: 24 | abi_check: 25 | uses: ros-controls/ros2_control_ci/.github/workflows/reusable-abi-check.yml@master 26 | with: 27 | ros_distro: kilted 28 | -------------------------------------------------------------------------------- /ros_controls.rolling.repos: -------------------------------------------------------------------------------- 1 | repositories: 2 | gz_ros2_control: 3 | type: git 4 | url: https://github.com/ros-controls/gz_ros2_control.git 5 | version: rolling 6 | ros2_control_demos: 7 | type: git 8 | url: https://github.com/ros-controls/ros2_control_demos.git 9 | version: master 10 | ros2_controllers: 11 | type: git 12 | url: https://github.com/ros-controls/ros2_controllers.git 13 | version: master 14 | control_toolbox: 15 | type: git 16 | url: https://github.com/ros-controls/control_toolbox.git 17 | version: master 18 | kinematics_interface: 19 | type: git 20 | url: https://github.com/ros-controls/kinematics_interface.git 21 | version: master 22 | topic_based_hardware_interfaces: 23 | type: git 24 | url: https://github.com/ros-controls/topic_based_hardware_interfaces.git 25 | version: main 26 | -------------------------------------------------------------------------------- /.github/workflows/jazzy-source-build.yml: -------------------------------------------------------------------------------- 1 | name: Jazzy Source Build 2 | on: 3 | workflow_dispatch: 4 | push: 5 | branches: 6 | - jazzy 7 | paths: 8 | - '**.hpp' 9 | - '**.h' 10 | - '**.cpp' 11 | - '**.py' 12 | - '.github/workflows/jazzy-source-build.yml' 13 | - '**/package.xml' 14 | - '**/CMakeLists.txt' 15 | - 'ros2_control.jazzy.repos' 16 | pull_request: 17 | branches: 18 | - jazzy 19 | paths: 20 | - .github/workflows/jazzy-source-build.yml 21 | schedule: 22 | # Run every day to detect flakiness and broken dependencies 23 | - cron: '03 3 * * MON-FRI' 24 | 25 | jobs: 26 | source: 27 | uses: ros-controls/ros2_control_ci/.github/workflows/reusable-ros-tooling-source-build.yml@master 28 | with: 29 | ros_distro: jazzy 30 | ref: jazzy 31 | container: ubuntu:24.04 32 | -------------------------------------------------------------------------------- /controller_manager_msgs/srv/SetHardwareComponentState.srv: -------------------------------------------------------------------------------- 1 | # The SetHardwareComponentState service allows to control life-cycle of a single hardware component. 2 | # Supported states are defined in the design document of LifecycleNodes available at: 3 | # https://design.ros2.org/articles/node_lifecycle.html 4 | # To control life-cycle of a hardware component, specify its "name" and "target_state". 5 | # Target state may be defined by "id" using a constant from `lifecycle_msgs/msg/State` or a label 6 | # using definitions from `hardware_interface/types/lifecycle_state_names.hpp` file. 7 | # The return value "ok" indicates if the component has successfully changed its state to "target_state". 8 | # The return value "state" returns current state of the hardware component. 9 | 10 | string name 11 | lifecycle_msgs/State target_state 12 | --- 13 | bool ok 14 | lifecycle_msgs/State state 15 | -------------------------------------------------------------------------------- /ros2_control_test_assets/package.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | ros2_control_test_assets 5 | 6.2.0 6 | Shared test resources for ros2_control stack 7 | Bence Magyar 8 | Denis Štogl 9 | Christoph Froehlich 10 | Sai Kishor Kothakota 11 | Apache License 2.0 12 | 13 | ament_cmake 14 | 15 | ament_cmake 16 | 17 | 18 | -------------------------------------------------------------------------------- /joint_limits/src/joint_limiter_interface.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2024, Stogl Robotics Consulting UG (haftungsbeschränkt) 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | /// \author Dr. Denis Stogl 16 | 17 | #include "joint_limits/joint_limiter_interface.hpp" 18 | 19 | namespace joint_limits 20 | { 21 | } // namespace joint_limits 22 | -------------------------------------------------------------------------------- /.github/workflows/humble-source-build.yml: -------------------------------------------------------------------------------- 1 | name: Humble Source Build 2 | on: 3 | workflow_dispatch: 4 | push: 5 | branches: 6 | - humble 7 | paths: 8 | - '**.hpp' 9 | - '**.h' 10 | - '**.cpp' 11 | - '**.py' 12 | - '**.yaml' 13 | - '.github/workflows/humble-source-build.yml' 14 | - '**/package.xml' 15 | - '**/CMakeLists.txt' 16 | - 'ros2_control.humble.repos' 17 | pull_request: 18 | branches: 19 | - humble 20 | paths: 21 | - .github/workflows/humble-source-build.yml 22 | schedule: 23 | # Run every day to detect flakiness and broken dependencies 24 | - cron: '03 3 * * MON-FRI' 25 | 26 | jobs: 27 | source: 28 | uses: ros-controls/ros2_control_ci/.github/workflows/reusable-ros-tooling-source-build.yml@master 29 | with: 30 | ros_distro: humble 31 | ref: humble 32 | container: ubuntu:22.04 33 | -------------------------------------------------------------------------------- /.github/workflows/kilted-source-build.yml: -------------------------------------------------------------------------------- 1 | name: Kilted Source Build 2 | on: 3 | workflow_dispatch: 4 | push: 5 | branches: 6 | - kilted 7 | paths: 8 | - '**.hpp' 9 | - '**.h' 10 | - '**.cpp' 11 | - '**.py' 12 | - '**.yaml' 13 | - '.github/workflows/kilted-source-build.yml' 14 | - '**/package.xml' 15 | - '**/CMakeLists.txt' 16 | - 'ros2_control.kilted.repos' 17 | pull_request: 18 | branches: 19 | - kilted 20 | paths: 21 | - .github/workflows/kilted-source-build.yml 22 | schedule: 23 | # Run every day to detect flakiness and broken dependencies 24 | - cron: '03 3 * * MON-FRI' 25 | 26 | jobs: 27 | source: 28 | uses: ros-controls/ros2_control_ci/.github/workflows/reusable-ros-tooling-source-build.yml@master 29 | with: 30 | ros_distro: kilted 31 | ref: kilted 32 | container: ubuntu:24.04 33 | -------------------------------------------------------------------------------- /rqt_controller_manager/rqt_controller_manager/main.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2022 Kenji Brameld 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | 16 | import sys 17 | 18 | from rqt_gui.main import Main 19 | 20 | 21 | def main(): 22 | main = Main() 23 | sys.exit(main.main(sys.argv, standalone="rqt_controller_manager")) 24 | 25 | 26 | if __name__ == "__main__": 27 | main() 28 | -------------------------------------------------------------------------------- /.github/workflows/humble-coverage-build.yml: -------------------------------------------------------------------------------- 1 | name: Coverage Build - Humble 2 | on: 3 | workflow_dispatch: 4 | pull_request: &event 5 | branches: 6 | - humble 7 | paths: 8 | - '**.hpp' 9 | - '**.h' 10 | - '**.cpp' 11 | - '**.py' 12 | - '**.yaml' 13 | - '.github/workflows/humble-coverage-build.yml' 14 | - '**/package.xml' 15 | - '**/CMakeLists.txt' 16 | - 'ros2_control.humble.repos' 17 | - 'codecov.yml' 18 | push: *event 19 | 20 | concurrency: 21 | # cancel previous runs of the same workflow, except for pushes on given branches 22 | group: ${{ github.workflow }}-${{ github.ref }} 23 | cancel-in-progress: ${{ !startsWith(github.ref, 'refs/heads') }} 24 | 25 | jobs: 26 | coverage_humble: 27 | uses: ros-controls/ros2_control_ci/.github/workflows/reusable-build-coverage.yml@master 28 | secrets: inherit 29 | with: 30 | ros_distro: humble 31 | -------------------------------------------------------------------------------- /.github/workflows/rolling-coverage-build.yml: -------------------------------------------------------------------------------- 1 | name: Coverage Build - Rolling 2 | on: 3 | workflow_dispatch: 4 | pull_request: &event 5 | branches: 6 | - master 7 | paths: 8 | - '**.hpp' 9 | - '**.h' 10 | - '**.cpp' 11 | - '**.py' 12 | - '**.yaml' 13 | - '.github/workflows/rolling-coverage-build.yml' 14 | - '**/package.xml' 15 | - '**/CMakeLists.txt' 16 | - 'ros2_control.rolling.repos' 17 | - 'codecov.yml' 18 | push: *event 19 | 20 | concurrency: 21 | # cancel previous runs of the same workflow, except for pushes on given branches 22 | group: ${{ github.workflow }}-${{ github.ref }} 23 | cancel-in-progress: ${{ !startsWith(github.ref, 'refs/heads') }} 24 | 25 | jobs: 26 | coverage_rolling: 27 | uses: ros-controls/ros2_control_ci/.github/workflows/reusable-build-coverage.yml@master 28 | secrets: inherit 29 | with: 30 | ros_distro: rolling 31 | -------------------------------------------------------------------------------- /.github/workflows/kilted-pre-release.yml: -------------------------------------------------------------------------------- 1 | name: Kilted - pre-release 2 | # author: Christoph Froehlich 3 | 4 | on: 5 | workflow_dispatch: 6 | inputs: 7 | downstream_depth: 8 | description: 'The depth of the depends-on tree to be included in the overlay workspace (-1 implies unlimited, default: 0)' 9 | required: false 10 | default: 0 11 | type: number 12 | pull_request: 13 | branches: 14 | - kilted 15 | types: 16 | - opened # default 17 | - reopened # default 18 | - synchronize # default 19 | - labeled # also if a label changes 20 | 21 | jobs: 22 | default: 23 | uses: ros-controls/ros2_control_ci/.github/workflows/reusable-prerelease.yml@master 24 | with: 25 | ros_distro: kilted 26 | # downstream_depth is not set on pull_request event 27 | prerelease_downstream_depth: ${{ github.event_name == 'pull_request' && '0' || inputs.downstream_depth }} 28 | -------------------------------------------------------------------------------- /.github/workflows/rolling-abi-compatibility.yml: -------------------------------------------------------------------------------- 1 | name: Rolling - ABI Compatibility Check 2 | on: 3 | workflow_dispatch: 4 | pull_request: 5 | branches: 6 | - master 7 | paths: 8 | - '**.hpp' 9 | - '**.h' 10 | - '**.cpp' 11 | - '**.py' 12 | - '**.yaml' 13 | - '.github/workflows/rolling-abi-compatibility.yml' 14 | - '**/package.xml' 15 | - '**/CMakeLists.txt' 16 | - 'ros2_control-not-released.rolling.repos' 17 | 18 | concurrency: 19 | # cancel previous runs of the same workflow, except for pushes on given branches 20 | group: ${{ github.workflow }}-${{ github.ref }} 21 | cancel-in-progress: ${{ !startsWith(github.ref, 'refs/heads') }} 22 | 23 | jobs: 24 | abi_check: 25 | uses: ros-controls/ros2_control_ci/.github/workflows/reusable-abi-check.yml@master 26 | strategy: 27 | fail-fast: false 28 | matrix: 29 | ROS_DISTRO: [rolling] 30 | with: 31 | ros_distro: ${{ matrix.ROS_DISTRO }} 32 | -------------------------------------------------------------------------------- /ros_controls.humble.repos: -------------------------------------------------------------------------------- 1 | repositories: 2 | gz_ros2_control: 3 | type: git 4 | url: https://github.com/ros-controls/gz_ros2_control.git 5 | version: humble 6 | ros2_control_demos: 7 | type: git 8 | url: https://github.com/ros-controls/ros2_control_demos.git 9 | version: humble 10 | ros2_controllers: 11 | type: git 12 | url: https://github.com/ros-controls/ros2_controllers.git 13 | version: humble 14 | control_toolbox: 15 | type: git 16 | url: https://github.com/ros-controls/control_toolbox.git 17 | version: humble 18 | kinematics_interface: 19 | type: git 20 | url: https://github.com/ros-controls/kinematics_interface.git 21 | version: humble 22 | # deactivate until https://github.com/ros-controls/topic_based_hardware_interfaces/issues/9 is fixed 23 | # ros-controls/topic_based_hardware_interfaces: 24 | # type: git 25 | # url: https://github.com/ros-controls/topic_based_hardware_interfaces.git 26 | # version: main 27 | -------------------------------------------------------------------------------- /ros2_control_test_assets/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.16) 2 | project(ros2_control_test_assets LANGUAGES CXX) 3 | 4 | find_package(ament_cmake REQUIRED) 5 | 6 | add_library(ros2_control_test_assets INTERFACE) 7 | target_compile_features(ros2_control_test_assets INTERFACE cxx_std_17) 8 | target_include_directories(ros2_control_test_assets INTERFACE 9 | $ 10 | $ 11 | ) 12 | 13 | install( 14 | DIRECTORY include/ 15 | DESTINATION include/ros2_control_test_assets 16 | ) 17 | install( 18 | FILES urdf/test_hardware_components.urdf 19 | DESTINATION share/ros2_control_test_assets/urdf 20 | ) 21 | install(TARGETS ros2_control_test_assets 22 | EXPORT export_ros2_control_test_assets 23 | ARCHIVE DESTINATION lib 24 | LIBRARY DESTINATION lib 25 | RUNTIME DESTINATION bin 26 | ) 27 | 28 | ament_export_targets(export_ros2_control_test_assets HAS_LIBRARY_TARGET) 29 | ament_package() 30 | -------------------------------------------------------------------------------- /.github/workflows/rolling-source-build.yml: -------------------------------------------------------------------------------- 1 | name: Rolling Source Build 2 | on: 3 | workflow_dispatch: 4 | push: 5 | branches: 6 | - master 7 | paths: 8 | - '**.hpp' 9 | - '**.h' 10 | - '**.cpp' 11 | - '**.py' 12 | - '**.yaml' 13 | - '.github/workflows/rolling-source-build.yml' 14 | - '**/package.xml' 15 | - '**/CMakeLists.txt' 16 | - 'ros2_control.rolling.repos' 17 | pull_request: 18 | branches: 19 | - master 20 | paths: 21 | - .github/workflows/rolling-source-build.yml 22 | schedule: 23 | # Run every day to detect flakiness and broken dependencies 24 | - cron: '03 3 * * MON-FRI' 25 | 26 | jobs: 27 | source: 28 | uses: ros-controls/ros2_control_ci/.github/workflows/reusable-ros-tooling-source-build.yml@master 29 | strategy: 30 | fail-fast: false 31 | matrix: 32 | ROS_DISTRO: [rolling] 33 | with: 34 | ros_distro: ${{ matrix.ROS_DISTRO }} 35 | ref: master 36 | container: ubuntu:24.04 37 | -------------------------------------------------------------------------------- /hardware_interface/include/hardware_interface/types/trigger_type.hpp: -------------------------------------------------------------------------------- 1 | // Copyright 2024 ros2_control Development Team 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | #ifndef HARDWARE_INTERFACE__TYPES__TRIGGER_TYPE_HPP_ 16 | #define HARDWARE_INTERFACE__TYPES__TRIGGER_TYPE_HPP_ 17 | 18 | namespace hardware_interface 19 | { 20 | enum class TriggerType 21 | { 22 | READ, 23 | WRITE 24 | }; 25 | 26 | } // namespace hardware_interface 27 | 28 | #endif // HARDWARE_INTERFACE__TYPES__TRIGGER_TYPE_HPP_ 29 | -------------------------------------------------------------------------------- /hardware_interface/include/hardware_interface/sensor.hpp: -------------------------------------------------------------------------------- 1 | // Copyright 2020 - 2021 ros2_control Development Team 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | #ifndef HARDWARE_INTERFACE__SENSOR_HPP_ 16 | #define HARDWARE_INTERFACE__SENSOR_HPP_ 17 | 18 | #include "hardware_interface/hardware_component.hpp" 19 | #include "hardware_interface/sensor_interface.hpp" 20 | 21 | namespace hardware_interface 22 | { 23 | using Sensor = HardwareComponent; 24 | } // namespace hardware_interface 25 | #endif // HARDWARE_INTERFACE__SENSOR_HPP_ 26 | -------------------------------------------------------------------------------- /hardware_interface/include/hardware_interface/system.hpp: -------------------------------------------------------------------------------- 1 | // Copyright 2020 - 2021 ros2_control Development Team 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | #ifndef HARDWARE_INTERFACE__SYSTEM_HPP_ 16 | #define HARDWARE_INTERFACE__SYSTEM_HPP_ 17 | 18 | #include "hardware_interface/hardware_component.hpp" 19 | #include "hardware_interface/system_interface.hpp" 20 | 21 | namespace hardware_interface 22 | { 23 | using System = HardwareComponent; 24 | } // namespace hardware_interface 25 | #endif // HARDWARE_INTERFACE__SYSTEM_HPP_ 26 | -------------------------------------------------------------------------------- /hardware_interface/include/hardware_interface/actuator.hpp: -------------------------------------------------------------------------------- 1 | // Copyright 2020 - 2021 ros2_control Development Team 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | #ifndef HARDWARE_INTERFACE__ACTUATOR_HPP_ 16 | #define HARDWARE_INTERFACE__ACTUATOR_HPP_ 17 | 18 | #include "hardware_interface/actuator_interface.hpp" 19 | #include "hardware_interface/hardware_component.hpp" 20 | 21 | namespace hardware_interface 22 | { 23 | using Actuator = HardwareComponent; 24 | } // namespace hardware_interface 25 | #endif // HARDWARE_INTERFACE__ACTUATOR_HPP_ 26 | -------------------------------------------------------------------------------- /controller_interface/test/test_controller_tf_prefix.hpp: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2025, ros2_control developers 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | #ifndef TEST_CONTROLLER_TF_PREFIX_HPP_ 16 | #define TEST_CONTROLLER_TF_PREFIX_HPP_ 17 | 18 | #include 19 | #include 20 | 21 | class TestControllerTFPrefix : public ::testing::Test 22 | { 23 | public: 24 | void SetUp() override 25 | { 26 | // placeholder 27 | } 28 | void TearDown() override 29 | { 30 | // placeholder 31 | } 32 | }; 33 | 34 | #endif // TEST_CONTROLLER_TF_PREFIX_HPP_ 35 | -------------------------------------------------------------------------------- /.github/workflows/rolling-semi-binary-build-win.yml: -------------------------------------------------------------------------------- 1 | name: Rolling Windows Semi-Binary Build 2 | # author: Christoph Fröhlich 3 | # description: 'Build & test all dependencies from semi-binary packages.' 4 | 5 | on: 6 | workflow_dispatch: 7 | pull_request: &event 8 | branches: 9 | - master 10 | paths: 11 | - '**.hpp' 12 | - '**.h' 13 | - '**.cpp' 14 | - '**.py' 15 | - '**.yaml' 16 | - '.github/workflows/rolling-semi-binary-build-win.yml' 17 | - '**/package.xml' 18 | - '**/CMakeLists.txt' 19 | push: *event 20 | 21 | concurrency: 22 | # cancel previous runs of the same workflow, except for pushes on given branches 23 | group: ${{ github.workflow }}-${{ github.ref }} 24 | cancel-in-progress: ${{ !startsWith(github.ref, 'refs/heads') }} 25 | 26 | jobs: 27 | binary-windows: 28 | uses: ros-controls/ros2_control_ci/.github/workflows/reusable-ros-tooling-win-build.yml@master 29 | with: 30 | ros_distro: rolling 31 | pixi_dependencies: typeguard jinja2 boost compilers 32 | ninja_packages: rsl 33 | target_cmake_args: -DBUILD_TESTING=OFF 34 | -------------------------------------------------------------------------------- /hardware_interface_testing/package.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | hardware_interface_testing 4 | 6.2.0 5 | Commonly used test fixtures for the ros2_control framework 6 | Bence Magyar 7 | Denis Štogl 8 | Christoph Froehlich 9 | Sai Kishor Kothakota 10 | Apache License 2.0 11 | 12 | ament_cmake 13 | ros2_control_cmake 14 | 15 | control_msgs 16 | hardware_interface 17 | lifecycle_msgs 18 | pluginlib 19 | rclcpp_lifecycle 20 | ros2_control_test_assets 21 | fmt 22 | 23 | ament_cmake_gmock 24 | 25 | 26 | ament_cmake 27 | 28 | 29 | -------------------------------------------------------------------------------- /.github/workflows/humble-debian-build.yml: -------------------------------------------------------------------------------- 1 | name: Humble - Debian Semi-Binary Build 2 | on: 3 | workflow_dispatch: 4 | pull_request: 5 | branches: 6 | - humble 7 | paths: 8 | - '**.hpp' 9 | - '**.h' 10 | - '**.cpp' 11 | - '**.py' 12 | - '**.yaml' 13 | - '.github/workflows/humble-debian-build.yml' 14 | - '**/package.xml' 15 | - '**/CMakeLists.txt' 16 | - 'ros2_control.humble.repos' 17 | schedule: 18 | # Run every day to detect flakiness and broken dependencies 19 | - cron: '03 1 * * MON-FRI' 20 | 21 | concurrency: 22 | # cancel previous runs of the same workflow, except for pushes on given branches 23 | group: ${{ github.workflow }}-${{ github.ref }} 24 | cancel-in-progress: ${{ !startsWith(github.ref, 'refs/heads') }} 25 | 26 | jobs: 27 | debian_semi_binary_build: 28 | uses: ros-controls/ros2_control_ci/.github/workflows/reusable-debian-build.yml@master 29 | with: 30 | ros_distro: humble 31 | upstream_workspace: ros2_control.humble.repos 32 | ref_for_scheduled_build: humble 33 | skip_packages: rqt_controller_manager 34 | skip_packages_test: controller_manager_msgs 35 | -------------------------------------------------------------------------------- /.github/workflows/rolling-compatibility-jazzy-binary-build.yml: -------------------------------------------------------------------------------- 1 | name: Check Rolling Compatibility on Jazzy 2 | # author: Christoph Froehlich 3 | # description: 'Build & test the rolling version on Jazzy distro.' 4 | 5 | on: 6 | workflow_dispatch: 7 | pull_request: &event 8 | branches: 9 | - master 10 | paths: 11 | - '**.hpp' 12 | - '**.h' 13 | - '**.cpp' 14 | - '**.py' 15 | - '**.yaml' 16 | - '.github/workflows/rolling-compatibility-jazzy-binary-build.yml' 17 | - '**/package.xml' 18 | - '**/CMakeLists.txt' 19 | - 'ros2_control.rolling.repos' 20 | push: *event 21 | 22 | concurrency: 23 | # cancel previous runs of the same workflow, except for pushes on given branches 24 | group: ${{ github.workflow }}-${{ github.ref }} 25 | cancel-in-progress: ${{ !startsWith(github.ref, 'refs/heads') }} 26 | 27 | jobs: 28 | build-on-jazzy: 29 | uses: ros-controls/ros2_control_ci/.github/workflows/reusable-industrial-ci-with-cache.yml@master 30 | with: 31 | ros_distro: jazzy 32 | ros_repo: testing 33 | upstream_workspace: ros2_control.rolling.repos 34 | ref_for_scheduled_build: master 35 | -------------------------------------------------------------------------------- /.github/workflows/rolling-compatibility-humble-binary-build.yml: -------------------------------------------------------------------------------- 1 | name: Check Rolling Compatibility on Humble 2 | # author: Christoph Froehlich 3 | # description: 'Build & test the rolling version on Humble distro.' 4 | 5 | on: 6 | workflow_dispatch: 7 | pull_request: &event 8 | branches: 9 | - master 10 | paths: 11 | - '**.hpp' 12 | - '**.h' 13 | - '**.cpp' 14 | - '**.py' 15 | - '**.yaml' 16 | - '.github/workflows/rolling-compatibility-humble-binary-build.yml' 17 | - '**/package.xml' 18 | - '**/CMakeLists.txt' 19 | - 'ros2_control.rolling.repos' 20 | push: *event 21 | 22 | concurrency: 23 | # cancel previous runs of the same workflow, except for pushes on given branches 24 | group: ${{ github.workflow }}-${{ github.ref }} 25 | cancel-in-progress: ${{ !startsWith(github.ref, 'refs/heads') }} 26 | 27 | jobs: 28 | build-on-humble: 29 | uses: ros-controls/ros2_control_ci/.github/workflows/reusable-industrial-ci-with-cache.yml@master 30 | with: 31 | ros_distro: humble 32 | ros_repo: testing 33 | upstream_workspace: ros2_control.rolling.repos 34 | ref_for_scheduled_build: master 35 | -------------------------------------------------------------------------------- /.github/workflows/rolling-compatibility-kilted-binary-build.yml: -------------------------------------------------------------------------------- 1 | name: Check Rolling Compatibility on Kilted 2 | # author: Christoph Froehlich 3 | # description: 'Build & test the rolling version on Kilted distro.' 4 | 5 | on: 6 | workflow_dispatch: 7 | pull_request: &event 8 | branches: 9 | - master 10 | paths: 11 | - '**.hpp' 12 | - '**.h' 13 | - '**.cpp' 14 | - '**.py' 15 | - '**.yaml' 16 | - '.github/workflows/rolling-compatibility-kilted-binary-build.yml' 17 | - '**/package.xml' 18 | - '**/CMakeLists.txt' 19 | - 'ros2_control.rolling.repos' 20 | push: *event 21 | 22 | concurrency: 23 | # cancel previous runs of the same workflow, except for pushes on given branches 24 | group: ${{ github.workflow }}-${{ github.ref }} 25 | cancel-in-progress: ${{ !startsWith(github.ref, 'refs/heads') }} 26 | 27 | jobs: 28 | build-on-kilted: 29 | uses: ros-controls/ros2_control_ci/.github/workflows/reusable-industrial-ci-with-cache.yml@master 30 | with: 31 | ros_distro: kilted 32 | ros_repo: testing 33 | upstream_workspace: ros2_control.rolling.repos 34 | ref_for_scheduled_build: master 35 | -------------------------------------------------------------------------------- /controller_manager_msgs/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.16) 2 | project(controller_manager_msgs) 3 | 4 | find_package(ament_cmake REQUIRED) 5 | find_package(builtin_interfaces REQUIRED) 6 | find_package(lifecycle_msgs REQUIRED) 7 | find_package(std_msgs REQUIRED) 8 | find_package(rosidl_default_generators REQUIRED) 9 | 10 | set(msg_files 11 | msg/ControllerState.msg 12 | msg/ChainConnection.msg 13 | msg/HardwareComponentState.msg 14 | msg/HardwareInterface.msg 15 | msg/NamedLifecycleState.msg 16 | msg/ControllerManagerActivity.msg 17 | ) 18 | set(srv_files 19 | srv/ConfigureController.srv 20 | srv/ListControllers.srv 21 | srv/ListControllerTypes.srv 22 | srv/ListHardwareComponents.srv 23 | srv/ListHardwareInterfaces.srv 24 | srv/LoadController.srv 25 | srv/ReloadControllerLibraries.srv 26 | srv/SetHardwareComponentState.srv 27 | srv/SwitchController.srv 28 | srv/UnloadController.srv 29 | srv/CleanupController.srv 30 | ) 31 | 32 | rosidl_generate_interfaces(${PROJECT_NAME} 33 | ${msg_files} 34 | ${srv_files} 35 | DEPENDENCIES builtin_interfaces lifecycle_msgs std_msgs 36 | ADD_LINTER_TESTS 37 | ) 38 | ament_export_dependencies(rosidl_default_runtime) 39 | ament_package() 40 | -------------------------------------------------------------------------------- /transmission_interface/ros2_control_plugins.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 6 | 7 | Load configuration of a simple transmission from a URDF description. 8 | 9 | 10 | 11 | 14 | 15 | Load configuration of a four bar linkage transmission from a URDF description. 16 | 17 | 18 | 19 | 22 | 23 | Load configuration of a four bar linkage transmission from a URDF description. 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /.github/workflows/jazzy-debian-build.yml: -------------------------------------------------------------------------------- 1 | name: Jazzy - Debian Semi-Binary Build 2 | on: 3 | workflow_dispatch: 4 | pull_request: 5 | branches: 6 | - jazzy 7 | paths: 8 | - '**.hpp' 9 | - '**.h' 10 | - '**.cpp' 11 | - '**.py' 12 | - '**.yaml' 13 | - '.github/workflows/jazzy-debian-build.yml' 14 | - '**/package.xml' 15 | - '**/CMakeLists.txt' 16 | - 'ros2_control.jazzy.repos' 17 | schedule: 18 | # Run every day to detect flakiness and broken dependencies 19 | - cron: '03 1 * * MON-FRI' 20 | 21 | concurrency: 22 | # cancel previous runs of the same workflow, except for pushes on given branches 23 | group: ${{ github.workflow }}-${{ github.ref }} 24 | cancel-in-progress: ${{ !startsWith(github.ref, 'refs/heads') }} 25 | 26 | jobs: 27 | debian_semi_binary_build: 28 | uses: ros-controls/ros2_control_ci/.github/workflows/reusable-debian-build.yml@master 29 | strategy: 30 | fail-fast: false 31 | matrix: 32 | ROS_DISTRO: [jazzy] 33 | with: 34 | ros_distro: ${{ matrix.ROS_DISTRO }} 35 | upstream_workspace: ros2_control.${{ matrix.ROS_DISTRO }}.repos 36 | ref_for_scheduled_build: jazzy 37 | skip_packages: rqt_controller_manager 38 | -------------------------------------------------------------------------------- /.github/workflows/kilted-debian-build.yml: -------------------------------------------------------------------------------- 1 | name: Kilted - Debian Semi-Binary Build 2 | on: 3 | workflow_dispatch: 4 | pull_request: 5 | branches: 6 | - kilted 7 | paths: 8 | - '**.hpp' 9 | - '**.h' 10 | - '**.cpp' 11 | - '**.py' 12 | - '**.yaml' 13 | - '.github/workflows/kilted-debian-build.yml' 14 | - '**/package.xml' 15 | - '**/CMakeLists.txt' 16 | - 'ros2_control.kilted.repos' 17 | schedule: 18 | # Run every day to detect flakiness and broken dependencies 19 | - cron: '03 1 * * MON-FRI' 20 | 21 | concurrency: 22 | # cancel previous runs of the same workflow, except for pushes on given branches 23 | group: ${{ github.workflow }}-${{ github.ref }} 24 | cancel-in-progress: ${{ !startsWith(github.ref, 'refs/heads') }} 25 | 26 | jobs: 27 | debian_semi_binary_build: 28 | uses: ros-controls/ros2_control_ci/.github/workflows/reusable-debian-build.yml@master 29 | strategy: 30 | fail-fast: false 31 | matrix: 32 | ROS_DISTRO: [kilted] 33 | with: 34 | ros_distro: ${{ matrix.ROS_DISTRO }} 35 | upstream_workspace: ros2_control.${{ matrix.ROS_DISTRO }}.repos 36 | ref_for_scheduled_build: kilted 37 | skip_packages: rqt_controller_manager 38 | -------------------------------------------------------------------------------- /.github/workflows/jazzy-rhel-binary-build.yml: -------------------------------------------------------------------------------- 1 | name: Jazzy - RHEL Semi-Binary Build 2 | on: 3 | workflow_dispatch: 4 | pull_request: 5 | branches: 6 | - jazzy 7 | paths: 8 | - '**.hpp' 9 | - '**.h' 10 | - '**.cpp' 11 | - '**.py' 12 | - '**.yaml' 13 | - '.github/workflows/jazzy-rhel-binary-build.yml' 14 | - '**/package.xml' 15 | - '**/CMakeLists.txt' 16 | - 'ros2_control.jazzy.repos' 17 | schedule: 18 | # Run every day to detect flakiness and broken dependencies 19 | - cron: '03 1 * * MON-FRI' 20 | 21 | concurrency: 22 | # cancel previous runs of the same workflow, except for pushes on given branches 23 | group: ${{ github.workflow }}-${{ github.ref }} 24 | cancel-in-progress: ${{ !startsWith(github.ref, 'refs/heads') }} 25 | 26 | jobs: 27 | rhel_semi_binary_build: 28 | uses: ros-controls/ros2_control_ci/.github/workflows/reusable-rhel-binary-build.yml@master 29 | strategy: 30 | fail-fast: false 31 | matrix: 32 | ROS_DISTRO: [jazzy] 33 | with: 34 | ros_distro: ${{ matrix.ROS_DISTRO }} 35 | upstream_workspace: ros2_control.${{ matrix.ROS_DISTRO }}.repos 36 | ref_for_scheduled_build: jazzy 37 | skip_packages: rqt_controller_manager 38 | -------------------------------------------------------------------------------- /.github/workflows/stale.yml: -------------------------------------------------------------------------------- 1 | name: 'Stale issues and PRs' 2 | on: 3 | workflow_dispatch: 4 | schedule: 5 | # UTC noon every workday 6 | - cron: '0 12 * * MON-FRI' 7 | 8 | jobs: 9 | stale: 10 | runs-on: ubuntu-latest 11 | permissions: 12 | issues: write 13 | pull-requests: write 14 | steps: 15 | - uses: actions/stale@v10 16 | with: 17 | stale-issue-label: 'stale' 18 | stale-pr-label: 'stale' 19 | stale-issue-message: 'This issue is being labeled as stale because it has been open 45 days with no activity. It will be automatically closed after another 45 days without follow-ups.' 20 | close-issue-message: 'This issue was closed because it has been stalled for 45 days with no activity.' 21 | stale-pr-message: 'This PR is stale because it has been open for 45 days with no activity. Please tag a maintainer for help on completing this PR, or close it if you think it has become obsolete.' 22 | days-before-stale: 45 23 | days-before-close: 45 24 | days-before-pr-close: -1 25 | exempt-all-milestones: true 26 | exempt-issue-labels: good first issue,good second issue,persistent,release,roadmap,Epic 27 | operations-per-run: 100 28 | -------------------------------------------------------------------------------- /.github/workflows/humble-rhel-binary-build.yml: -------------------------------------------------------------------------------- 1 | name: Humble - RHEL Semi-Binary Build 2 | on: 3 | workflow_dispatch: 4 | pull_request: 5 | branches: 6 | - humble 7 | paths: 8 | - '**.hpp' 9 | - '**.h' 10 | - '**.cpp' 11 | - '**.py' 12 | - '**.yaml' 13 | - '.github/workflows/humble-rhel-binary-build.yml' 14 | - '**/package.xml' 15 | - '**/CMakeLists.txt' 16 | - 'ros2_control.humble.repos' 17 | schedule: 18 | # Run every day to detect flakiness and broken dependencies 19 | - cron: '03 1 * * MON-FRI' 20 | 21 | concurrency: 22 | # cancel previous runs of the same workflow, except for pushes on given branches 23 | group: ${{ github.workflow }}-${{ github.ref }} 24 | cancel-in-progress: ${{ !startsWith(github.ref, 'refs/heads') }} 25 | 26 | jobs: 27 | rhel_semi_binary_build: 28 | uses: ros-controls/ros2_control_ci/.github/workflows/reusable-rhel-binary-build.yml@master 29 | strategy: 30 | fail-fast: false 31 | matrix: 32 | ROS_DISTRO: [humble] 33 | with: 34 | ros_distro: ${{ matrix.ROS_DISTRO }} 35 | upstream_workspace: ros2_control.${{ matrix.ROS_DISTRO }}.repos 36 | ref_for_scheduled_build: humble 37 | skip_packages: rqt_controller_manager 38 | -------------------------------------------------------------------------------- /.github/workflows/kilted-rhel-binary-build.yml: -------------------------------------------------------------------------------- 1 | name: Kilted - RHEL Semi-Binary Build 2 | on: 3 | workflow_dispatch: 4 | pull_request: 5 | branches: 6 | - kilted 7 | paths: 8 | - '**.hpp' 9 | - '**.h' 10 | - '**.cpp' 11 | - '**.py' 12 | - '**.yaml' 13 | - '.github/workflows/kilted-rhel-binary-build.yml' 14 | - '**/package.xml' 15 | - '**/CMakeLists.txt' 16 | - 'ros2_control.kilted.repos' 17 | schedule: 18 | # Run every day to detect flakiness and broken dependencies 19 | - cron: '03 1 * * MON-FRI' 20 | 21 | concurrency: 22 | # cancel previous runs of the same workflow, except for pushes on given branches 23 | group: ${{ github.workflow }}-${{ github.ref }} 24 | cancel-in-progress: ${{ !startsWith(github.ref, 'refs/heads') }} 25 | 26 | jobs: 27 | rhel_semi_binary_build: 28 | uses: ros-controls/ros2_control_ci/.github/workflows/reusable-rhel-binary-build.yml@master 29 | strategy: 30 | fail-fast: false 31 | matrix: 32 | ROS_DISTRO: [kilted] 33 | with: 34 | ros_distro: ${{ matrix.ROS_DISTRO }} 35 | upstream_workspace: ros2_control.${{ matrix.ROS_DISTRO }}.repos 36 | ref_for_scheduled_build: kilted 37 | skip_packages: rqt_controller_manager 38 | -------------------------------------------------------------------------------- /.github/workflows/rolling-debian-build.yml: -------------------------------------------------------------------------------- 1 | name: Rolling - Debian Semi-Binary Build 2 | on: 3 | workflow_dispatch: 4 | pull_request: 5 | branches: 6 | - master 7 | paths: 8 | - '**.hpp' 9 | - '**.h' 10 | - '**.cpp' 11 | - '**.py' 12 | - '**.yaml' 13 | - '.github/workflows/rolling-debian-build.yml' 14 | - '**/package.xml' 15 | - '**/CMakeLists.txt' 16 | - 'ros2_control.rolling.repos' 17 | schedule: 18 | # Run every day to detect flakiness and broken dependencies 19 | - cron: '03 1 * * MON-FRI' 20 | 21 | concurrency: 22 | # cancel previous runs of the same workflow, except for pushes on given branches 23 | group: ${{ github.workflow }}-${{ github.ref }} 24 | cancel-in-progress: ${{ !startsWith(github.ref, 'refs/heads') }} 25 | 26 | 27 | jobs: 28 | debian_semi_binary_build: 29 | uses: ros-controls/ros2_control_ci/.github/workflows/reusable-debian-build.yml@master 30 | strategy: 31 | fail-fast: false 32 | matrix: 33 | ROS_DISTRO: [rolling] 34 | with: 35 | ros_distro: ${{ matrix.ROS_DISTRO }} 36 | upstream_workspace: ros2_control.${{ matrix.ROS_DISTRO }}.repos 37 | ref_for_scheduled_build: master 38 | skip_packages: rqt_controller_manager 39 | -------------------------------------------------------------------------------- /ros2_control/package.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | ros2_control 4 | 6.2.0 5 | Metapackage for ROS2 control related packages 6 | Bence Magyar 7 | Denis Štogl 8 | Christoph Froehlich 9 | Sai Kishor Kothakota 10 | 11 | https://control.ros.org 12 | 13 | Apache License 2.0 14 | 15 | ament_cmake 16 | 17 | controller_interface 18 | controller_manager 19 | controller_manager_msgs 20 | hardware_interface 21 | joint_limits 22 | ros2_control_test_assets 23 | ros2controlcli 24 | transmission_interface 25 | 26 | 27 | ament_cmake 28 | rosdoc2.yaml 29 | 30 | 31 | -------------------------------------------------------------------------------- /.github/workflows/rolling-rhel-binary-build.yml: -------------------------------------------------------------------------------- 1 | name: Rolling - RHEL Semi-Binary Build 2 | on: 3 | workflow_dispatch: 4 | pull_request: 5 | branches: 6 | - master 7 | paths: 8 | - '**.hpp' 9 | - '**.h' 10 | - '**.cpp' 11 | - '**.py' 12 | - '**.yaml' 13 | - '.github/workflows/rolling-rhel-binary-build.yml' 14 | - '**/package.xml' 15 | - '**/CMakeLists.txt' 16 | - 'ros2_control.rolling.repos' 17 | schedule: 18 | # Run every day to detect flakiness and broken dependencies 19 | - cron: '03 1 * * MON-FRI' 20 | 21 | concurrency: 22 | # cancel previous runs of the same workflow, except for pushes on given branches 23 | group: ${{ github.workflow }}-${{ github.ref }} 24 | cancel-in-progress: ${{ !startsWith(github.ref, 'refs/heads') }} 25 | 26 | jobs: 27 | rhel_semi_binary_build: 28 | uses: ros-controls/ros2_control_ci/.github/workflows/reusable-rhel-binary-build.yml@master 29 | strategy: 30 | fail-fast: false 31 | matrix: 32 | ROS_DISTRO: [rolling] 33 | with: 34 | ros_distro: ${{ matrix.ROS_DISTRO }} 35 | upstream_workspace: ros2_control.${{ matrix.ROS_DISTRO }}.repos 36 | ref_for_scheduled_build: master 37 | skip_packages: rqt_controller_manager 38 | -------------------------------------------------------------------------------- /hardware_interface/test/test_inst_hardwares.cpp: -------------------------------------------------------------------------------- 1 | // Copyright 2023 LAAS CNRS 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | #include "gmock/gmock.h" 16 | #include "hardware_interface/actuator.hpp" 17 | #include "hardware_interface/sensor.hpp" 18 | #include "hardware_interface/system.hpp" 19 | 20 | class TestInstantiationHardwares : public ::testing::Test 21 | { 22 | protected: 23 | static void SetUpTestCase() {} 24 | }; 25 | 26 | TEST_F(TestInstantiationHardwares, build_actuator) { hardware_interface::Actuator anActuator; } 27 | 28 | TEST_F(TestInstantiationHardwares, build_sensor) { hardware_interface::Sensor aSensor; } 29 | 30 | TEST_F(TestInstantiationHardwares, build_system) { hardware_interface::System aSystem; } 31 | -------------------------------------------------------------------------------- /ros2controlcli/package.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | ros2controlcli 5 | 6.2.0 6 | The ROS 2 command line tools for ros2_control. 7 | Bence Magyar 8 | Denis Štogl 9 | Christoph Froehlich 10 | Sai Kishor Kothakota 11 | Apache License 2.0 12 | Victor Lopez 13 | 14 | rcl_interfaces 15 | rclpy 16 | ros2cli 17 | ros2node 18 | ros2param 19 | controller_manager 20 | controller_manager_msgs 21 | control_msgs 22 | rosidl_runtime_py 23 | python3-pygraphviz 24 | 25 | 26 | ament_python 27 | 28 | 29 | -------------------------------------------------------------------------------- /.github/workflows/jazzy-semi-binary-downstream-build.yml: -------------------------------------------------------------------------------- 1 | name: Jazzy Downstream Build 2 | # description: 'Build & test downstream packages from source.' 3 | # author: Christoph Froehlich 4 | 5 | on: 6 | workflow_dispatch: 7 | pull_request: 8 | branches: 9 | - jazzy 10 | paths: 11 | - '**.hpp' 12 | - '**.h' 13 | - '**.cpp' 14 | - '**.py' 15 | - '**.yaml' 16 | - '.github/workflows/jazzy-semi-binary-downstream-build.yml' 17 | - '**/package.xml' 18 | - '**/CMakeLists.txt' 19 | - 'ros_controls.jazzy.repos' 20 | 21 | concurrency: 22 | group: ${{ github.workflow }}-${{ github.ref }} 23 | cancel-in-progress: true 24 | 25 | jobs: 26 | build-downstream: 27 | uses: ros-controls/ros2_control_ci/.github/workflows/reusable-industrial-ci-with-cache.yml@master 28 | with: 29 | ros_distro: jazzy 30 | ros_repo: testing 31 | ref_for_scheduled_build: jazzy 32 | upstream_workspace: ros2_control.jazzy.repos 33 | # we don't test target_workspace, we just build it 34 | not_test_build: true 35 | # we test the downstream packages, which are part of our organization 36 | downstream_workspace: ros_controls.jazzy.repos 37 | not_test_downstream: false 38 | -------------------------------------------------------------------------------- /.github/dependabot.yml: -------------------------------------------------------------------------------- 1 | # To get started with Dependabot version updates, you'll need to specify which 2 | # package ecosystems to update and where the package manifests are located. 3 | # Please see the documentation for all configuration options: 4 | # https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates 5 | 6 | version: 2 7 | updates: 8 | - package-ecosystem: "github-actions" 9 | # Workflow files stored in the 10 | # default location of `.github/workflows` 11 | directory: "/" 12 | schedule: 13 | interval: "weekly" 14 | - package-ecosystem: "github-actions" 15 | # Workflow files stored in the 16 | # default location of `.github/workflows` 17 | directory: "/" 18 | schedule: 19 | interval: "weekly" 20 | target-branch: "humble" 21 | - package-ecosystem: "github-actions" 22 | # Workflow files stored in the 23 | # default location of `.github/workflows` 24 | directory: "/" 25 | schedule: 26 | interval: "weekly" 27 | target-branch: "jazzy" 28 | - package-ecosystem: "github-actions" 29 | # Workflow files stored in the 30 | # default location of `.github/workflows` 31 | directory: "/" 32 | schedule: 33 | interval: "weekly" 34 | target-branch: "kilted" 35 | -------------------------------------------------------------------------------- /.github/workflows/humble-semi-binary-downstream-build.yml: -------------------------------------------------------------------------------- 1 | name: Humble Downstream Build 2 | # description: 'Build & test downstream packages from source.' 3 | # author: Christoph Froehlich 4 | 5 | on: 6 | workflow_dispatch: 7 | pull_request: 8 | branches: 9 | - humble 10 | paths: 11 | - '**.hpp' 12 | - '**.h' 13 | - '**.cpp' 14 | - '**.py' 15 | - '**.yaml' 16 | - '.github/workflows/humble-semi-binary-downstream-build.yml' 17 | - '**/package.xml' 18 | - '**/CMakeLists.txt' 19 | - 'ros_controls.humble.repos' 20 | 21 | concurrency: 22 | group: ${{ github.workflow }}-${{ github.ref }} 23 | cancel-in-progress: true 24 | 25 | jobs: 26 | build-downstream: 27 | uses: ros-controls/ros2_control_ci/.github/workflows/reusable-industrial-ci-with-cache.yml@master 28 | with: 29 | ros_distro: humble 30 | ros_repo: testing 31 | ref_for_scheduled_build: humble 32 | upstream_workspace: ros2_control.humble.repos 33 | # we don't test target_workspace, we just build it 34 | not_test_build: true 35 | # we test the downstream packages, which are part of our organization 36 | downstream_workspace: ros_controls.humble.repos 37 | not_test_downstream: false 38 | -------------------------------------------------------------------------------- /.github/workflows/kilted-semi-binary-downstream-build.yml: -------------------------------------------------------------------------------- 1 | name: Kilted Downstream Build 2 | # description: 'Build & test downstream packages from source.' 3 | # author: Christoph Froehlich 4 | 5 | on: 6 | workflow_dispatch: 7 | pull_request: 8 | branches: 9 | - kilted 10 | paths: 11 | - '**.hpp' 12 | - '**.h' 13 | - '**.cpp' 14 | - '**.py' 15 | - '**.yaml' 16 | - '.github/workflows/kilted-semi-binary-downstream-build.yml' 17 | - '**/package.xml' 18 | - '**/CMakeLists.txt' 19 | - 'ros_controls.kilted.repos' 20 | 21 | concurrency: 22 | group: ${{ github.workflow }}-${{ github.ref }} 23 | cancel-in-progress: true 24 | 25 | jobs: 26 | build-downstream: 27 | uses: ros-controls/ros2_control_ci/.github/workflows/reusable-industrial-ci-with-cache.yml@master 28 | with: 29 | ros_distro: kilted 30 | ros_repo: testing 31 | ref_for_scheduled_build: kilted 32 | upstream_workspace: ros2_control.kilted.repos 33 | # we don't test target_workspace, we just build it 34 | not_test_build: true 35 | # we test the downstream packages, which are part of our organization 36 | downstream_workspace: ros_controls.kilted.repos 37 | not_test_downstream: false 38 | -------------------------------------------------------------------------------- /controller_manager_msgs/msg/ControllerState.msg: -------------------------------------------------------------------------------- 1 | string name # controller name 2 | string state # controller state: unconfigured, inactive, active, or finalized 3 | string type # the controller class name, e.g. joint_trajectory_controller/JointTrajectoryController 4 | bool is_async # true, if controller runs asynchronously. false, if controller runs synchronously 5 | uint16 update_rate # update rate of the controller in Hz 6 | string[] claimed_interfaces # command interfaces currently owned by controller 7 | string[] required_command_interfaces # command interfaces required by controller 8 | string[] required_state_interfaces # state interfaces required by controller 9 | bool is_chainable # specifies whether or not controller can export references for a controller chain 10 | bool is_chained # specifies whether or not controller's exported references are claimed by another controller 11 | string[] exported_state_interfaces # state interfaces to be exported (only applicable if is_chainable is true) 12 | string[] reference_interfaces # references to be exported (only applicable if is_chainable is true) 13 | ChainConnection[] chain_connections # specifies list of controllers and their exported references that the controller is chained to 14 | -------------------------------------------------------------------------------- /transmission_interface/package.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | transmission_interface 5 | 6.2.0 6 | data structures for representing mechanical transmissions, methods for propagating values between actuator and joint spaces and tooling to support this. 7 | Bence Magyar 8 | Denis Štogl 9 | Christoph Froehlich 10 | Sai Kishor Kothakota 11 | Apache License 2.0 12 | 13 | ament_cmake 14 | ament_cmake_gen_version_h 15 | ros2_control_cmake 16 | 17 | hardware_interface 18 | pluginlib 19 | fmt 20 | 21 | ament_cmake_gmock 22 | ros2_control_test_assets 23 | 24 | 25 | ament_cmake 26 | 27 | 28 | -------------------------------------------------------------------------------- /doc/index.rst: -------------------------------------------------------------------------------- 1 | :github_url: https://github.com/ros-controls/ros2_control/blob/{REPOS_FILE_BRANCH}/doc/index.rst 2 | 3 | .. _ros2_control_framework: 4 | 5 | ################# 6 | ros2_control 7 | ################# 8 | 9 | This is the documentation of the ros2_control framework core. 10 | 11 | `GitHub Repository `_ 12 | 13 | ================= 14 | API Documentation 15 | ================= 16 | 17 | API documentation is parsed by doxygen and can be found `here <../../api/index.html>`_ 18 | 19 | ======== 20 | Concepts 21 | ======== 22 | 23 | .. toctree:: 24 | :titlesonly: 25 | 26 | Controller Manager <../controller_manager/doc/userdoc.rst> 27 | Controller Chaining / Cascade Control <../controller_manager/doc/controller_chaining.rst> 28 | Joint Kinematics <../hardware_interface/doc/joints_userdoc.rst> 29 | Hardware Components <../hardware_interface/doc/hardware_components_userdoc.rst> 30 | Mock Components <../hardware_interface/doc/mock_components_userdoc.rst> 31 | 32 | ===================================== 33 | Guidelines and Best Practices 34 | ===================================== 35 | 36 | .. toctree:: 37 | :titlesonly: 38 | 39 | Debugging the Controller Manager and Plugins 40 | Introspecting Controllers and Hardware Components 41 | -------------------------------------------------------------------------------- /transmission_interface/include/transmission_interface/exception.hpp: -------------------------------------------------------------------------------- 1 | // Copyright 2020 PAL Robotics S.L. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | #ifndef TRANSMISSION_INTERFACE__EXCEPTION_HPP_ 15 | #define TRANSMISSION_INTERFACE__EXCEPTION_HPP_ 16 | 17 | #include 18 | #include 19 | 20 | namespace transmission_interface 21 | { 22 | class Exception : public std::exception 23 | { 24 | public: 25 | explicit Exception(const char * message) : msg(message) {} 26 | explicit Exception(const std::string & message) : msg(message) {} 27 | const char * what() const noexcept override { return msg.c_str(); } 28 | 29 | private: 30 | std::string msg; 31 | }; 32 | 33 | } // namespace transmission_interface 34 | 35 | #endif // TRANSMISSION_INTERFACE__EXCEPTION_HPP_ 36 | -------------------------------------------------------------------------------- /joint_limits/joint_limiters.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 6 | 7 | Simple joint limiter using clamping approach. Warning: clamping can cause discontinuities. 8 | 9 | 10 | 13 | 14 | Simple joint range limiter using clamping approach with the parsed limits. 15 | 16 | 17 | 20 | 21 | Simple joint range limiter performing clamping between the parsed soft limits and the parsed joint limits. 22 | 23 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /hardware_interface/include/hardware_interface/lifecycle_helpers.hpp: -------------------------------------------------------------------------------- 1 | // Copyright 2024 PAL Robotics S.L. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | #ifndef HARDWARE_INTERFACE__LIFECYCLE_HELPERS_HPP_ 16 | #define HARDWARE_INTERFACE__LIFECYCLE_HELPERS_HPP_ 17 | 18 | #include 19 | 20 | namespace hardware_interface 21 | { 22 | constexpr bool lifecycleStateThatRequiresNoAction(const lifecycle_msgs::msg::State::_id_type state) 23 | { 24 | return state == lifecycle_msgs::msg::State::PRIMARY_STATE_UNKNOWN || 25 | state == lifecycle_msgs::msg::State::PRIMARY_STATE_UNCONFIGURED || 26 | state == lifecycle_msgs::msg::State::PRIMARY_STATE_FINALIZED; 27 | } 28 | } // namespace hardware_interface 29 | 30 | #endif // HARDWARE_INTERFACE__LIFECYCLE_HELPERS_HPP_ 31 | -------------------------------------------------------------------------------- /transmission_interface/include/transmission_interface/transmission_interface_exception.hpp: -------------------------------------------------------------------------------- 1 | // Copyright 2022 PAL Robotics S.L. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | #ifndef TRANSMISSION_INTERFACE__TRANSMISSION_INTERFACE_EXCEPTION_HPP_ 16 | #define TRANSMISSION_INTERFACE__TRANSMISSION_INTERFACE_EXCEPTION_HPP_ 17 | 18 | #include 19 | #include 20 | 21 | namespace transmission_interface 22 | { 23 | class TransmissionInterfaceException : public std::exception 24 | { 25 | public: 26 | explicit TransmissionInterfaceException(const std::string & message) : msg(message) {} 27 | const char * what() const noexcept override { return msg.c_str(); } 28 | 29 | private: 30 | std::string msg; 31 | }; 32 | 33 | } // namespace transmission_interface 34 | 35 | #endif // TRANSMISSION_INTERFACE__TRANSMISSION_INTERFACE_EXCEPTION_HPP_ 36 | -------------------------------------------------------------------------------- /controller_manager/test/test_controller_spawner_with_type.yaml: -------------------------------------------------------------------------------- 1 | ctrl_with_parameters_and_type: 2 | ros__parameters: 3 | type: "controller_manager/test_controller" 4 | joint_names: ["joint0"] 5 | interface_name: "position" 6 | 7 | /**: 8 | chainable_ctrl_with_parameters_and_type: 9 | ros__parameters: 10 | type: "controller_manager/test_chainable_controller" 11 | joint_names: ["joint1"] 12 | 13 | wildcard_ctrl_with_parameters_and_type: 14 | ros__parameters: 15 | type: "controller_manager/test_controller" 16 | joint_names: ["joint1"] 17 | 18 | ctrl_with_parameters_and_no_type: 19 | ros__parameters: 20 | joint_names: ["joint2"] 21 | 22 | /foo_namespace/ns_ctrl_with_parameters_and_type: 23 | ros__parameters: 24 | type: "controller_manager/test_controller" 25 | joint_names: ["joint1"] 26 | 27 | /foo_namespace/ns_chainable_ctrl_with_parameters_and_type: 28 | ros__parameters: 29 | type: "controller_manager/test_chainable_controller" 30 | joint_names: ["joint1"] 31 | 32 | /foo_namespace/ns_ctrl_with_parameters_and_no_type: 33 | ros__parameters: 34 | joint_names: ["joint2"] 35 | 36 | /**/wildcard_chainable_ctrl_with_parameters_and_type: 37 | ros__parameters: 38 | type: "controller_manager/test_chainable_controller" 39 | joint_names: ["joint1"] 40 | 41 | /**/wildcard_ctrl_with_parameters_and_no_type: 42 | ros__parameters: 43 | joint_names: ["joint2"] 44 | -------------------------------------------------------------------------------- /hardware_interface/test/test_components.hpp: -------------------------------------------------------------------------------- 1 | // Copyright 2020 ros2_control Development Team 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | #ifndef TEST_COMPONENTS_HPP_ 16 | #define TEST_COMPONENTS_HPP_ 17 | 18 | #include 19 | #include 20 | #include 21 | #include 22 | 23 | #include "hardware_interface/handle.hpp" 24 | 25 | namespace test_components 26 | { 27 | 28 | template 29 | std::pair vector_contains(const std::vector & vec, const T & element) 30 | { 31 | auto it = std::find_if( 32 | vec.begin(), vec.end(), [element](const auto & state_interface) 33 | { return state_interface->get_name() == std::string(element); }); 34 | 35 | return std::make_pair(it != vec.end(), std::distance(vec.begin(), it)); 36 | } 37 | 38 | } // namespace test_components 39 | #endif // TEST_COMPONENTS_HPP_ 40 | -------------------------------------------------------------------------------- /.github/workflows/rolling-semi-binary-downstream-build.yml: -------------------------------------------------------------------------------- 1 | name: Rolling Downstream Build 2 | # description: 'Build & test downstream packages from source.' 3 | # author: Christoph Froehlich 4 | 5 | on: 6 | workflow_dispatch: 7 | pull_request: 8 | branches: 9 | - master 10 | paths: 11 | - '**.hpp' 12 | - '**.h' 13 | - '**.cpp' 14 | - '**.py' 15 | - '**.yaml' 16 | - '.github/workflows/rolling-semi-binary-downstream-build.yml' 17 | - '**/package.xml' 18 | - '**/CMakeLists.txt' 19 | - 'ros_controls.rolling.repos' 20 | 21 | concurrency: 22 | group: ${{ github.workflow }}-${{ github.ref }} 23 | cancel-in-progress: true 24 | 25 | jobs: 26 | build-downstream: 27 | uses: ros-controls/ros2_control_ci/.github/workflows/reusable-industrial-ci-with-cache.yml@master 28 | strategy: 29 | fail-fast: false 30 | matrix: 31 | ROS_DISTRO: [rolling] 32 | with: 33 | ros_distro: ${{ matrix.ROS_DISTRO }} 34 | ros_repo: testing 35 | ref_for_scheduled_build: master 36 | upstream_workspace: ros2_control.${{ matrix.ROS_DISTRO }}.repos 37 | # we don't test target_workspace, we just build it 38 | not_test_build: true 39 | # we test the downstream packages, which are part of our organization 40 | downstream_workspace: ros_controls.${{ matrix.ROS_DISTRO }}.repos 41 | not_test_downstream: false 42 | -------------------------------------------------------------------------------- /.github/workflows/jazzy-binary-build.yml: -------------------------------------------------------------------------------- 1 | name: Jazzy Binary Build 2 | # author: Denis Štogl 3 | # description: 'Build & test all dependencies from released (binary) packages.' 4 | 5 | on: 6 | workflow_dispatch: 7 | pull_request: &event 8 | branches: 9 | - jazzy 10 | paths: 11 | - '**.hpp' 12 | - '**.h' 13 | - '**.cpp' 14 | - '**.py' 15 | - '**.yaml' 16 | - '.github/workflows/jazzy-binary-build.yml' 17 | - '**/package.xml' 18 | - '**/CMakeLists.txt' 19 | - 'ros2_control-not-released.jazzy.repos' 20 | push: *event 21 | schedule: 22 | # Run every morning to detect flakiness and broken dependencies 23 | - cron: '03 1 * * MON-FRI' 24 | 25 | concurrency: 26 | # cancel previous runs of the same workflow, except for pushes on given branches 27 | group: ${{ github.workflow }}-${{ github.ref }} 28 | cancel-in-progress: ${{ !startsWith(github.ref, 'refs/heads') }} 29 | 30 | jobs: 31 | binary: 32 | uses: ros-controls/ros2_control_ci/.github/workflows/reusable-industrial-ci-with-cache.yml@master 33 | strategy: 34 | fail-fast: false 35 | matrix: 36 | ROS_DISTRO: [jazzy] 37 | ROS_REPO: [main, testing] 38 | with: 39 | ros_distro: ${{ matrix.ROS_DISTRO }} 40 | ros_repo: ${{ matrix.ROS_REPO }} 41 | upstream_workspace: ros2_control-not-released.${{ matrix.ROS_DISTRO }}.repos 42 | ref_for_scheduled_build: jazzy 43 | -------------------------------------------------------------------------------- /hardware_interface/include/hardware_interface/types/lifecycle_state_names.hpp: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2021, Stogl Robotics Consulting UG (haftungsbeschränkt) 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | // 15 | /// \author: Denis Stogl 16 | 17 | #ifndef HARDWARE_INTERFACE__TYPES__LIFECYCLE_STATE_NAMES_HPP_ 18 | #define HARDWARE_INTERFACE__TYPES__LIFECYCLE_STATE_NAMES_HPP_ 19 | 20 | namespace hardware_interface 21 | { 22 | namespace lifecycle_state_names 23 | { 24 | /// Constants defining string labels corresponding to lifecycle states 25 | constexpr char UNKNOWN[] = "unknown"; 26 | constexpr char UNCONFIGURED[] = "unconfigured"; 27 | constexpr char INACTIVE[] = "inactive"; 28 | constexpr char ACTIVE[] = "active"; 29 | constexpr char FINALIZED[] = "finalized"; 30 | } // namespace lifecycle_state_names 31 | 32 | } // namespace hardware_interface 33 | 34 | #endif // HARDWARE_INTERFACE__TYPES__LIFECYCLE_STATE_NAMES_HPP_ 35 | -------------------------------------------------------------------------------- /.github/workflows/humble-binary-build.yml: -------------------------------------------------------------------------------- 1 | name: Humble Binary Build 2 | # author: Denis Štogl 3 | # description: 'Build & test all dependencies from released (binary) packages.' 4 | 5 | on: 6 | workflow_dispatch: 7 | pull_request: &event 8 | branches: 9 | - humble 10 | paths: 11 | - '**.hpp' 12 | - '**.h' 13 | - '**.cpp' 14 | - '**.py' 15 | - '**.yaml' 16 | - '.github/workflows/humble-binary-build.yml' 17 | - '**/package.xml' 18 | - '**/CMakeLists.txt' 19 | - 'ros2_control-not-released.humble.repos' 20 | push: *event 21 | schedule: 22 | # Run every morning to detect flakiness and broken dependencies 23 | - cron: '03 1 * * MON-FRI' 24 | 25 | concurrency: 26 | # cancel previous runs of the same workflow, except for pushes on given branches 27 | group: ${{ github.workflow }}-${{ github.ref }} 28 | cancel-in-progress: ${{ !startsWith(github.ref, 'refs/heads') }} 29 | 30 | jobs: 31 | binary: 32 | uses: ros-controls/ros2_control_ci/.github/workflows/reusable-industrial-ci-with-cache.yml@master 33 | strategy: 34 | fail-fast: false 35 | matrix: 36 | ROS_DISTRO: [humble] 37 | ROS_REPO: [main, testing] 38 | with: 39 | ros_distro: ${{ matrix.ROS_DISTRO }} 40 | ros_repo: ${{ matrix.ROS_REPO }} 41 | upstream_workspace: ros2_control-not-released.${{ matrix.ROS_DISTRO }}.repos 42 | ref_for_scheduled_build: humble 43 | -------------------------------------------------------------------------------- /.github/workflows/kilted-binary-build.yml: -------------------------------------------------------------------------------- 1 | name: Kilted Binary Build 2 | # author: Denis Štogl 3 | # description: 'Build & test all dependencies from released (binary) packages.' 4 | 5 | on: 6 | workflow_dispatch: 7 | pull_request: &event 8 | branches: 9 | - kilted 10 | paths: 11 | - '**.hpp' 12 | - '**.h' 13 | - '**.cpp' 14 | - '**.py' 15 | - '**.yaml' 16 | - '.github/workflows/kilted-binary-build.yml' 17 | - '**/package.xml' 18 | - '**/CMakeLists.txt' 19 | - 'ros2_control-not-released.kilted.repos' 20 | push: *event 21 | schedule: 22 | # Run every morning to detect flakiness and broken dependencies 23 | - cron: '03 1 * * MON-FRI' 24 | 25 | concurrency: 26 | # cancel previous runs of the same workflow, except for pushes on given branches 27 | group: ${{ github.workflow }}-${{ github.ref }} 28 | cancel-in-progress: ${{ !startsWith(github.ref, 'refs/heads') }} 29 | 30 | jobs: 31 | binary: 32 | uses: ros-controls/ros2_control_ci/.github/workflows/reusable-industrial-ci-with-cache.yml@master 33 | strategy: 34 | fail-fast: false 35 | matrix: 36 | ROS_DISTRO: [kilted] 37 | ROS_REPO: [main, testing] 38 | with: 39 | ros_distro: ${{ matrix.ROS_DISTRO }} 40 | ros_repo: ${{ matrix.ROS_REPO }} 41 | upstream_workspace: ros2_control-not-released.${{ matrix.ROS_DISTRO }}.repos 42 | ref_for_scheduled_build: kilted 43 | -------------------------------------------------------------------------------- /.github/workflows/rolling-binary-build.yml: -------------------------------------------------------------------------------- 1 | name: Rolling Binary Build 2 | # author: Denis Štogl 3 | # description: 'Build & test all dependencies from released (binary) packages.' 4 | 5 | on: 6 | workflow_dispatch: 7 | pull_request: &event 8 | branches: 9 | - master 10 | paths: 11 | - '**.hpp' 12 | - '**.h' 13 | - '**.cpp' 14 | - '**.py' 15 | - '**.yaml' 16 | - '.github/workflows/rolling-binary-build.yml' 17 | - '**/package.xml' 18 | - '**/CMakeLists.txt' 19 | - 'ros2_control-not-released.rolling.repos' 20 | push: *event 21 | schedule: 22 | # Run every morning to detect flakiness and broken dependencies 23 | - cron: '03 1 * * MON-FRI' 24 | 25 | concurrency: 26 | # cancel previous runs of the same workflow, except for pushes on given branches 27 | group: ${{ github.workflow }}-${{ github.ref }} 28 | cancel-in-progress: ${{ !startsWith(github.ref, 'refs/heads') }} 29 | 30 | jobs: 31 | binary: 32 | uses: ros-controls/ros2_control_ci/.github/workflows/reusable-industrial-ci-with-cache.yml@master 33 | strategy: 34 | fail-fast: false 35 | matrix: 36 | ROS_DISTRO: [rolling] 37 | ROS_REPO: [main, testing] 38 | with: 39 | ros_distro: ${{ matrix.ROS_DISTRO }} 40 | ros_repo: ${{ matrix.ROS_REPO }} 41 | upstream_workspace: ros2_control-not-released.${{ matrix.ROS_DISTRO }}.repos 42 | ref_for_scheduled_build: master 43 | -------------------------------------------------------------------------------- /transmission_interface/include/transmission_interface/simple_transmission_loader.hpp: -------------------------------------------------------------------------------- 1 | // Copyright 2022 PAL Robotics S.L. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | #ifndef TRANSMISSION_INTERFACE__SIMPLE_TRANSMISSION_LOADER_HPP_ 16 | #define TRANSMISSION_INTERFACE__SIMPLE_TRANSMISSION_LOADER_HPP_ 17 | 18 | #include 19 | 20 | #include 21 | #include 22 | 23 | namespace transmission_interface 24 | { 25 | /** 26 | * \brief Class for loading a simple transmission instance from configuration data. 27 | */ 28 | class SimpleTransmissionLoader : public TransmissionLoader 29 | { 30 | public: 31 | std::shared_ptr load( 32 | const hardware_interface::TransmissionInfo & transmission_info) override; 33 | }; 34 | 35 | } // namespace transmission_interface 36 | 37 | #endif // TRANSMISSION_INTERFACE__SIMPLE_TRANSMISSION_LOADER_HPP_ 38 | -------------------------------------------------------------------------------- /ros2controlcli/ros2controlcli/command/control.py: -------------------------------------------------------------------------------- 1 | # Copyright 2020 PAL Robotics S.L. 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | 16 | from ros2cli.command import add_subparsers_on_demand 17 | from ros2cli.command import CommandExtension 18 | 19 | 20 | class ControlCommand(CommandExtension): 21 | """Various control related sub-commands.""" 22 | 23 | def add_arguments(self, parser, cli_name): 24 | self._subparser = parser 25 | # get verb extensions and let them add their arguments 26 | add_subparsers_on_demand(parser, cli_name, "_verb", "ros2controlcli.verb", required=False) 27 | 28 | def main(self, *, parser, args): 29 | if not hasattr(args, "_verb"): 30 | # in case no verb was passed 31 | self._subparser.print_help() 32 | return 0 33 | 34 | extension = getattr(args, "_verb") 35 | 36 | # call the verb's main method 37 | return extension.main(args=args) 38 | -------------------------------------------------------------------------------- /transmission_interface/test/utils_test.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2023 PAL Robotics S.L. All rights reserved. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | #include "gmock/gmock.h" 16 | #include "hardware_interface/types/hardware_interface_type_values.hpp" 17 | #include "transmission_interface/accessor.hpp" 18 | #include "transmission_interface/handle.hpp" 19 | 20 | using hardware_interface::HW_IF_POSITION; 21 | using transmission_interface::JointHandle; 22 | 23 | TEST(UtilsTest, AccessorTest) 24 | { 25 | const std::string NAME = "joint"; 26 | double joint_value = 0.0; 27 | const JointHandle joint_handle(NAME, HW_IF_POSITION, &joint_value); 28 | const std::vector joint_handles = {joint_handle}; 29 | 30 | ASSERT_EQ(transmission_interface::get_names(joint_handles), std::vector{NAME}); 31 | ASSERT_EQ( 32 | transmission_interface::get_ordered_handles(joint_handles, {NAME}, HW_IF_POSITION), 33 | joint_handles); 34 | } 35 | -------------------------------------------------------------------------------- /ros2_control_test_assets/include/ros2_control_test_assets/test_hardware_interface_constants.hpp: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2023, FZI Forschungszentrum Informatik 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | // 15 | /// \author: Felix Exner 16 | 17 | #ifndef ROS2_CONTROL_TEST_ASSETS__TEST_HARDWARE_INTERFACE_CONSTANTS_HPP_ 18 | #define ROS2_CONTROL_TEST_ASSETS__TEST_HARDWARE_INTERFACE_CONSTANTS_HPP_ 19 | namespace test_constants 20 | { 21 | /// Constants defining special values used inside tests to trigger things like deactivate or errors 22 | /// on read/write. 23 | constexpr double READ_FAIL_VALUE = 28282828.0; 24 | constexpr double WRITE_FAIL_VALUE = 23232323.0; 25 | constexpr double READ_DEACTIVATE_VALUE = 29292929.0; 26 | constexpr double WRITE_DEACTIVATE_VALUE = 24242424.0; 27 | constexpr double RESET_STATE_INTERFACES_VALUE = 82937364.0; 28 | } // namespace test_constants 29 | #endif // ROS2_CONTROL_TEST_ASSETS__TEST_HARDWARE_INTERFACE_CONSTANTS_HPP_ 30 | -------------------------------------------------------------------------------- /controller_interface/src/controller_interface.cpp: -------------------------------------------------------------------------------- 1 | // Copyright 2017 Open Source Robotics Foundation, Inc. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | #include "controller_interface/controller_interface.hpp" 16 | 17 | #include 18 | 19 | namespace controller_interface 20 | { 21 | ControllerInterface::ControllerInterface() : ControllerInterfaceBase() {} 22 | 23 | bool ControllerInterface::is_chainable() const { return false; } 24 | 25 | std::vector 26 | ControllerInterface::export_state_interfaces() 27 | { 28 | return {}; 29 | } 30 | 31 | std::vector 32 | ControllerInterface::export_reference_interfaces() 33 | { 34 | return {}; 35 | } 36 | 37 | bool ControllerInterface::set_chained_mode(bool /*chained_mode*/) { return false; } 38 | 39 | bool ControllerInterface::is_in_chained_mode() const { return false; } 40 | 41 | } // namespace controller_interface 42 | -------------------------------------------------------------------------------- /transmission_interface/include/transmission_interface/differential_transmission_loader.hpp: -------------------------------------------------------------------------------- 1 | // Copyright 2022 PAL Robotics S.L. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | #ifndef TRANSMISSION_INTERFACE__DIFFERENTIAL_TRANSMISSION_LOADER_HPP_ 16 | #define TRANSMISSION_INTERFACE__DIFFERENTIAL_TRANSMISSION_LOADER_HPP_ 17 | 18 | #include 19 | 20 | #include "transmission_interface/transmission.hpp" 21 | #include "transmission_interface/transmission_loader.hpp" 22 | 23 | namespace transmission_interface 24 | { 25 | /** 26 | * \brief Class for loading a four-bar linkage transmission instance from configuration data. 27 | */ 28 | class DifferentialTransmissionLoader : public TransmissionLoader 29 | { 30 | public: 31 | std::shared_ptr load( 32 | const hardware_interface::TransmissionInfo & transmission_info) override; 33 | }; 34 | 35 | } // namespace transmission_interface 36 | 37 | #endif // TRANSMISSION_INTERFACE__DIFFERENTIAL_TRANSMISSION_LOADER_HPP_ 38 | -------------------------------------------------------------------------------- /controller_manager_msgs/package.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | controller_manager_msgs 5 | 6.2.0 6 | Messages and services for the controller manager. 7 | Bence Magyar 8 | Denis Štogl 9 | Christoph Froehlich 10 | Sai Kishor Kothakota 11 | BSD 12 | http://ros.org/wiki/controller_manager_msgs 13 | Stuart Glaser 14 | 15 | ament_cmake 16 | rosidl_default_generators 17 | 18 | builtin_interfaces 19 | lifecycle_msgs 20 | std_msgs 21 | 22 | builtin_interfaces 23 | lifecycle_msgs 24 | std_msgs 25 | rosidl_default_runtime 26 | 27 | ament_lint_common 28 | 29 | rosidl_interface_packages 30 | 31 | ament_cmake 32 | 33 | 34 | -------------------------------------------------------------------------------- /hardware_interface/package.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | hardware_interface 4 | 6.2.0 5 | Base classes for hardware abstraction and tooling for them 6 | Bence Magyar 7 | Denis Štogl 8 | Christoph Froehlich 9 | Sai Kishor Kothakota 10 | Apache License 2.0 11 | 12 | ament_cmake 13 | ament_cmake_gen_version_h 14 | ros2_control_cmake 15 | 16 | backward_ros 17 | control_msgs 18 | joint_limits 19 | lifecycle_msgs 20 | pal_statistics 21 | pluginlib 22 | rclcpp_lifecycle 23 | rcpputils 24 | realtime_tools 25 | sdformat_urdf 26 | tinyxml2 27 | urdf 28 | fmt 29 | 30 | rcutils 31 | rcutils 32 | 33 | ament_cmake_gmock 34 | ros2_control_test_assets 35 | 36 | 37 | ament_cmake 38 | 39 | 40 | -------------------------------------------------------------------------------- /transmission_interface/include/transmission_interface/four_bar_linkage_transmission_loader.hpp: -------------------------------------------------------------------------------- 1 | // Copyright 2022 PAL Robotics S.L. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | #ifndef TRANSMISSION_INTERFACE__FOUR_BAR_LINKAGE_TRANSMISSION_LOADER_HPP_ 16 | #define TRANSMISSION_INTERFACE__FOUR_BAR_LINKAGE_TRANSMISSION_LOADER_HPP_ 17 | 18 | #include 19 | 20 | #include "transmission_interface/transmission.hpp" 21 | #include "transmission_interface/transmission_loader.hpp" 22 | 23 | namespace transmission_interface 24 | { 25 | /** 26 | * \brief Class for loading a four-bar linkage transmission instance from configuration data. 27 | */ 28 | class FourBarLinkageTransmissionLoader : public TransmissionLoader 29 | { 30 | public: 31 | std::shared_ptr load( 32 | const hardware_interface::TransmissionInfo & transmission_info) override; 33 | }; 34 | 35 | } // namespace transmission_interface 36 | 37 | #endif // TRANSMISSION_INTERFACE__FOUR_BAR_LINKAGE_TRANSMISSION_LOADER_HPP_ 38 | -------------------------------------------------------------------------------- /transmission_interface/include/transmission_interface/transmission_loader.hpp: -------------------------------------------------------------------------------- 1 | // Copyright 2022 PAL Robotics S.L. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | #ifndef TRANSMISSION_INTERFACE__TRANSMISSION_LOADER_HPP_ 16 | #define TRANSMISSION_INTERFACE__TRANSMISSION_LOADER_HPP_ 17 | 18 | #include 19 | 20 | #include "hardware_interface/hardware_info.hpp" 21 | 22 | #include "transmission_interface/transmission.hpp" 23 | 24 | namespace transmission_interface 25 | { 26 | /** 27 | * \brief Abstract interface for loading transmission instances from configuration data. 28 | * 29 | * It also provides convenience methods for specific transmission loaders to leverage. 30 | */ 31 | class TransmissionLoader 32 | { 33 | public: 34 | virtual ~TransmissionLoader() = default; 35 | 36 | virtual std::shared_ptr load( 37 | const hardware_interface::TransmissionInfo & transmission_info) = 0; 38 | }; 39 | 40 | } // namespace transmission_interface 41 | 42 | #endif // TRANSMISSION_INTERFACE__TRANSMISSION_LOADER_HPP_ 43 | -------------------------------------------------------------------------------- /ros2controlcli/ros2controlcli/verb/list_controller_types.py: -------------------------------------------------------------------------------- 1 | # Copyright 2020 PAL Robotics S.L. 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | from controller_manager import list_controller_types 16 | 17 | from ros2cli.node.direct import add_arguments 18 | from ros2cli.node.strategy import NodeStrategy 19 | from ros2cli.verb import VerbExtension 20 | 21 | from ros2controlcli.api import add_controller_mgr_parsers 22 | 23 | 24 | class ListControllerTypesVerb(VerbExtension): 25 | """Output the available controller types and their base classes.""" 26 | 27 | def add_arguments(self, parser, cli_name): 28 | add_arguments(parser) 29 | add_controller_mgr_parsers(parser) 30 | 31 | def main(self, *, args): 32 | with NodeStrategy(args).direct_node as node: 33 | response = list_controller_types(node, args.controller_manager) 34 | types_and_classes = zip(response.types, response.base_classes) 35 | for c in types_and_classes: 36 | print(f"{c[0]:70s} {c[1]}") 37 | 38 | return 0 39 | -------------------------------------------------------------------------------- /ros2_control/doc/index.rst: -------------------------------------------------------------------------------- 1 | Welcome to the documentation for ros2_control 2 | ================================================ 3 | 4 | For more information of the ros2_control framework see `control.ros.org `__. 5 | 6 | .. list-table:: 7 | :header-rows: 1 8 | 9 | * - Package Name 10 | - API 11 | - ROS Index 12 | * - controller_interface 13 | - `API `__ 14 | - `ROS Index `__ 15 | * - controller_manager 16 | - `API `__ 17 | - `ROS Index `__ 18 | * - controller_manager_msgs 19 | - `API `__ 20 | - `ROS Index `__ 21 | * - hardware_interface 22 | - `API `__ 23 | - `ROS Index `__ 24 | * - joint_limits 25 | - `API `__ 26 | - `ROS Index `__ 27 | * - ros2_control_test_assets 28 | - `API `__ 29 | - `ROS Index `__ 30 | * - transmission_interface 31 | - `API `__ 32 | - `ROS Index `__ 33 | -------------------------------------------------------------------------------- /controller_manager/test/test_controller_failed_init/test_controller_failed_init.cpp: -------------------------------------------------------------------------------- 1 | // Copyright 2021 ros2_control development team 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | #include "test_controller_failed_init.hpp" 16 | 17 | namespace test_controller_failed_init 18 | { 19 | TestControllerFailedInit::TestControllerFailedInit() : controller_interface::ControllerInterface() 20 | { 21 | } 22 | 23 | rclcpp_lifecycle::node_interfaces::LifecycleNodeInterface::CallbackReturn 24 | TestControllerFailedInit::on_init() 25 | { 26 | return rclcpp_lifecycle::node_interfaces::LifecycleNodeInterface::CallbackReturn::FAILURE; 27 | } 28 | 29 | controller_interface::return_type TestControllerFailedInit::update( 30 | const rclcpp::Time & /*time*/, const rclcpp::Duration & /*period*/) 31 | { 32 | return controller_interface::return_type::OK; 33 | } 34 | 35 | } // namespace test_controller_failed_init 36 | 37 | #include "pluginlib/class_list_macros.hpp" 38 | 39 | PLUGINLIB_EXPORT_CLASS( 40 | test_controller_failed_init::TestControllerFailedInit, controller_interface::ControllerInterface) 41 | -------------------------------------------------------------------------------- /hardware_interface/test/test_hardware_components/test_hardware_components.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Test actuator component for a single position joint 6 | 7 | 8 | 9 | 10 | 11 | Test sensor component emulating a force torque sensor 12 | 13 | 14 | 15 | 16 | 17 | Test sensor component emulating an IMU sensor 18 | 19 | 20 | 21 | 22 | 23 | Test system component for a two degree of freedom position joint robot 24 | 25 | 26 | 27 | 28 | 29 | Test system component for a system with both position and velocity command modes 30 | 31 | 32 | 33 | -------------------------------------------------------------------------------- /.github/workflows/jazzy-semi-binary-build.yml: -------------------------------------------------------------------------------- 1 | name: Jazzy Semi-Binary Build 2 | # author: Denis Štogl 3 | # description: 'Build & test all ros2_control dependencies from source.' 4 | 5 | on: 6 | workflow_dispatch: 7 | pull_request: &event 8 | branches: 9 | - jazzy 10 | paths: 11 | - '**.hpp' 12 | - '**.h' 13 | - '**.cpp' 14 | - '**.py' 15 | - '**.yaml' 16 | - '.github/workflows/jazzy-semi-binary-build.yml' 17 | - '**/package.xml' 18 | - '**/CMakeLists.txt' 19 | - 'ros2_control.jazzy.repos' 20 | push: *event 21 | schedule: 22 | # Run every morning to detect flakiness and broken dependencies 23 | - cron: '03 1 * * MON-FRI' 24 | 25 | concurrency: 26 | # cancel previous runs of the same workflow, except for pushes on given branches 27 | group: ${{ github.workflow }}-${{ github.ref }} 28 | cancel-in-progress: ${{ !startsWith(github.ref, 'refs/heads') }} 29 | 30 | jobs: 31 | semi-binary: 32 | uses: ros-controls/ros2_control_ci/.github/workflows/reusable-industrial-ci-with-cache.yml@master 33 | with: 34 | ros_distro: jazzy 35 | ros_repo: testing 36 | upstream_workspace: ros2_control.jazzy.repos 37 | ref_for_scheduled_build: jazzy 38 | semi-binary-clang: 39 | uses: ros-controls/ros2_control_ci/.github/workflows/reusable-industrial-ci-with-cache.yml@master 40 | with: 41 | ros_distro: jazzy 42 | ros_repo: testing 43 | upstream_workspace: ros2_control.jazzy.repos 44 | ref_for_scheduled_build: jazzy 45 | additional_debs: clang 46 | c_compiler: clang 47 | cxx_compiler: clang++ 48 | not_test_build: true 49 | -------------------------------------------------------------------------------- /.github/workflows/kilted-semi-binary-build.yml: -------------------------------------------------------------------------------- 1 | name: Kilted Semi-Binary Build 2 | # author: Denis Štogl 3 | # description: 'Build & test all ros2_control dependencies from source.' 4 | 5 | on: 6 | workflow_dispatch: 7 | pull_request: &event 8 | branches: 9 | - kilted 10 | paths: 11 | - '**.hpp' 12 | - '**.h' 13 | - '**.cpp' 14 | - '**.py' 15 | - '**.yaml' 16 | - '.github/workflows/kilted-semi-binary-build.yml' 17 | - '**/package.xml' 18 | - '**/CMakeLists.txt' 19 | - 'ros2_control.kilted.repos' 20 | push: *event 21 | schedule: 22 | # Run every morning to detect flakiness and broken dependencies 23 | - cron: '03 1 * * MON-FRI' 24 | 25 | concurrency: 26 | # cancel previous runs of the same workflow, except for pushes on given branches 27 | group: ${{ github.workflow }}-${{ github.ref }} 28 | cancel-in-progress: ${{ !startsWith(github.ref, 'refs/heads') }} 29 | 30 | jobs: 31 | semi-binary: 32 | uses: ros-controls/ros2_control_ci/.github/workflows/reusable-industrial-ci-with-cache.yml@master 33 | with: 34 | ros_distro: kilted 35 | ros_repo: testing 36 | upstream_workspace: ros2_control.kilted.repos 37 | ref_for_scheduled_build: kilted 38 | semi-binary-clang: 39 | uses: ros-controls/ros2_control_ci/.github/workflows/reusable-industrial-ci-with-cache.yml@master 40 | with: 41 | ros_distro: kilted 42 | ros_repo: testing 43 | upstream_workspace: ros2_control.kilted.repos 44 | ref_for_scheduled_build: kilted 45 | additional_debs: clang 46 | c_compiler: clang 47 | cxx_compiler: clang++ 48 | not_test_build: true 49 | -------------------------------------------------------------------------------- /controller_interface/package.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | controller_interface 5 | 6.2.0 6 | Base classes for controllers and syntax cookies for supporting common sensor types in controllers and broadcasters 7 | Bence Magyar 8 | Denis Štogl 9 | Christoph Froehlich 10 | Sai Kishor Kothakota 11 | Apache License 2.0 12 | 13 | ament_cmake 14 | ament_cmake_gen_version_h 15 | 16 | hardware_interface 17 | rclcpp_lifecycle 18 | realtime_tools 19 | ros2_control_cmake 20 | fmt 21 | 22 | hardware_interface 23 | realtime_tools 24 | rclcpp_lifecycle 25 | 26 | realtime_tools 27 | 28 | ament_cmake_gmock 29 | geometry_msgs 30 | sensor_msgs 31 | std_msgs 32 | 33 | 34 | ament_cmake 35 | 36 | 37 | -------------------------------------------------------------------------------- /.github/workflows/jazzy-pre-release.yml: -------------------------------------------------------------------------------- 1 | name: Jazzy - pre-release 2 | # author: Christoph Froehlich 3 | 4 | on: 5 | workflow_dispatch: 6 | inputs: 7 | downstream_depth: 8 | description: 'The depth of the depends-on tree to be included in the overlay workspace (-1 implies unlimited, default: 0)' 9 | required: false 10 | default: 0 11 | type: number 12 | pull_request: 13 | branches: 14 | - jazzy 15 | types: 16 | - opened # default 17 | - reopened # default 18 | - synchronize # default 19 | - labeled # also if a label changes 20 | 21 | jobs: 22 | default: 23 | uses: ros-controls/ros2_control_ci/.github/workflows/reusable-prerelease.yml@master 24 | with: 25 | ros_distro: jazzy 26 | # downstream_depth is not set on pull_request event 27 | prerelease_downstream_depth: ${{ github.event_name == 'pull_request' && '0' || inputs.downstream_depth }} 28 | prerelease_exclude_pkg: ackermann_steering_controller admittance_controller bicycle_steering_controller chained_filter_controller diff_drive_controller effort_controllers force_torque_sensor_broadcaster forward_command_controller gpio_controllers gps_sensor_broadcaster imu_sensor_broadcaster joint_state_broadcaster joint_trajectory_controller mecanum_drive_controller motion_primitives_controllers omni_wheel_drive_controller parallel_gripper_controller pid_controller pose_broadcaster position_controllers range_sensor_broadcaster ros2_controllers ros2_controllers_test_nodes rqt_joint_trajectory_controller steering_controllers_library tricycle_controller tricycle_steering_controller velocity_controllers gz_ros2_control gz_ros2_control_demos gz_ros2_control_tests 29 | -------------------------------------------------------------------------------- /.github/workflows/humble-pre-release.yml: -------------------------------------------------------------------------------- 1 | name: Humble - pre-release 2 | # author: Christoph Froehlich 3 | 4 | on: 5 | workflow_dispatch: 6 | inputs: 7 | downstream_depth: 8 | description: 'The depth of the depends-on tree to be included in the overlay workspace (-1 implies unlimited, default: 0)' 9 | required: false 10 | default: 0 11 | type: number 12 | pull_request: 13 | branches: 14 | - humble 15 | types: 16 | - opened # default 17 | - reopened # default 18 | - synchronize # default 19 | - labeled # also if a label changes 20 | 21 | jobs: 22 | default: 23 | uses: ros-controls/ros2_control_ci/.github/workflows/reusable-prerelease.yml@master 24 | with: 25 | ros_distro: humble 26 | # downstream_depth is not set on pull_request event 27 | prerelease_downstream_depth: ${{ github.event_name == 'pull_request' && '0' || inputs.downstream_depth }} 28 | prerelease_exclude_pkg: ackermann_steering_controller admittance_controller bicycle_steering_controller chained_filter_controller diff_drive_controller effort_controllers force_torque_sensor_broadcaster forward_command_controller gpio_controllers gps_sensor_broadcaster imu_sensor_broadcaster joint_state_broadcaster joint_trajectory_controller mecanum_drive_controller motion_primitives_controllers omni_wheel_drive_controller parallel_gripper_controller pid_controller pose_broadcaster position_controllers range_sensor_broadcaster ros2_controllers ros2_controllers_test_nodes rqt_joint_trajectory_controller steering_controllers_library tricycle_controller tricycle_steering_controller velocity_controllers gz_ros2_control gz_ros2_control_demos gz_ros2_control_tests 29 | -------------------------------------------------------------------------------- /hardware_interface/include/hardware_interface/controller_info.hpp: -------------------------------------------------------------------------------- 1 | // Copyright 2020 PAL Robotics S.L. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | #ifndef HARDWARE_INTERFACE__CONTROLLER_INFO_HPP_ 16 | #define HARDWARE_INTERFACE__CONTROLLER_INFO_HPP_ 17 | 18 | #include 19 | #include 20 | #include 21 | 22 | namespace hardware_interface 23 | { 24 | /// Controller Information 25 | /** 26 | * This struct contains information about a given controller. 27 | */ 28 | struct ControllerInfo 29 | { 30 | /// Controller name. 31 | std::string name; 32 | 33 | /// Controller type. 34 | std::string type; 35 | 36 | /// Controller param file 37 | std::vector parameters_files; 38 | 39 | /// List of claimed interfaces by the controller. 40 | std::vector claimed_interfaces; 41 | 42 | /// List of fallback controller names to be activated if this controller fails. 43 | std::vector fallback_controllers_names; 44 | 45 | /// Controller node options arguments 46 | std::vector node_options_args; 47 | }; 48 | 49 | } // namespace hardware_interface 50 | #endif // HARDWARE_INTERFACE__CONTROLLER_INFO_HPP_ 51 | -------------------------------------------------------------------------------- /controller_manager/controller_manager/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2021 PAL Robotics S.L. 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | from .controller_manager_services import ( 16 | configure_controller, 17 | list_controller_types, 18 | list_controllers, 19 | list_hardware_components, 20 | list_hardware_interfaces, 21 | load_controller, 22 | reload_controller_libraries, 23 | set_hardware_component_state, 24 | switch_controllers, 25 | unload_controller, 26 | cleanup_controller, 27 | get_parameter_from_param_files, 28 | set_controller_parameters, 29 | set_controller_parameters_from_param_files, 30 | bcolors, 31 | ) 32 | 33 | __all__ = [ 34 | "configure_controller", 35 | "list_controller_types", 36 | "list_controllers", 37 | "list_hardware_components", 38 | "list_hardware_interfaces", 39 | "load_controller", 40 | "reload_controller_libraries", 41 | "set_hardware_component_state", 42 | "switch_controllers", 43 | "unload_controller", 44 | "cleanup_controller", 45 | "get_parameter_from_param_files", 46 | "set_controller_parameters", 47 | "set_controller_parameters_from_param_files", 48 | "bcolors", 49 | ] 50 | -------------------------------------------------------------------------------- /joint_limits/package.xml: -------------------------------------------------------------------------------- 1 | 2 | joint_limits 3 | 6.2.0 4 | Package with interfaces for handling of joint limits in controllers or in hardware. The package also implements Saturation Joint Limiter for position-velocity-acceleration set and other individual interfaces. 5 | 6 | Bence Magyar 7 | Denis Štogl 8 | Christoph Froehlich 9 | Sai Kishor Kothakota 10 | 11 | Apache License 2.0 12 | 13 | https://github.com/ros-controls/ros2_control/wiki 14 | https://github.com/ros-controls/ros2_control/issues 15 | https://github.com/ros-controls/ros2_control 16 | 17 | ament_cmake 18 | ament_cmake_gen_version_h 19 | ros2_control_cmake 20 | 21 | backward_ros 22 | pluginlib 23 | realtime_tools 24 | rclcpp 25 | rclcpp_lifecycle 26 | trajectory_msgs 27 | urdf 28 | fmt 29 | 30 | ament_cmake_gmock 31 | generate_parameter_library 32 | launch_ros 33 | launch_testing_ament_cmake 34 | 35 | 36 | ament_cmake 37 | 38 | 39 | -------------------------------------------------------------------------------- /rqt_controller_manager/setup.py: -------------------------------------------------------------------------------- 1 | # Copyright 2024 Apache License, Version 2.0 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | from glob import glob 16 | 17 | from setuptools import setup 18 | 19 | package_name = "rqt_controller_manager" 20 | 21 | setup( 22 | name=package_name, 23 | version="6.2.0", 24 | packages=[package_name], 25 | data_files=[ 26 | ("share/ament_index/resource_index/packages", ["resource/" + package_name]), 27 | ("share/" + package_name, ["package.xml"]), 28 | ("share/" + package_name + "/resource", glob("resource/*.*")), 29 | ("share/" + package_name, ["plugin.xml"]), 30 | ], 31 | install_requires=["setuptools"], 32 | zip_safe=True, 33 | maintainer="Bence Magyar", 34 | maintainer_email="bence.magyar.robotics@gmail.com", 35 | description="Graphical frontend for interacting with the controller manager.", 36 | license="Apache License, Version 2.0", 37 | extras_require={ 38 | "test": [ 39 | "pytest", 40 | ], 41 | }, 42 | entry_points={ 43 | "console_scripts": [ 44 | "rqt_controller_manager = \ 45 | rqt_controller_manager.main:main", 46 | ], 47 | }, 48 | ) 49 | -------------------------------------------------------------------------------- /ros2controlcli/ros2controlcli/verb/reload_controller_libraries.py: -------------------------------------------------------------------------------- 1 | # Copyright 2020 PAL Robotics S.L. 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | from controller_manager import reload_controller_libraries 16 | 17 | from ros2cli.node.direct import add_arguments 18 | from ros2cli.node.strategy import NodeStrategy 19 | from ros2cli.verb import VerbExtension 20 | 21 | from ros2controlcli.api import add_controller_mgr_parsers 22 | 23 | 24 | class ReloadControllerLibrariesVerb(VerbExtension): 25 | """Reload controller libraries.""" 26 | 27 | def add_arguments(self, parser, cli_name): 28 | add_arguments(parser) 29 | parser.add_argument( 30 | "--force-kill", action="store_true", help="Force stop of loaded controllers" 31 | ) 32 | add_controller_mgr_parsers(parser) 33 | 34 | def main(self, *, args): 35 | with NodeStrategy(args).direct_node as node: 36 | response = reload_controller_libraries( 37 | node, args.controller_manager, force_kill=args.force_kill 38 | ) 39 | if not response.ok: 40 | return "Error reloading libraries, check controller_manager logs" 41 | 42 | print("Reload successful") 43 | return 0 44 | -------------------------------------------------------------------------------- /controller_interface/include/controller_interface/tf_prefix.hpp: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2025, ros2_control developers 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | #ifndef CONTROLLER_INTERFACE__TF_PREFIX_HPP_ 16 | #define CONTROLLER_INTERFACE__TF_PREFIX_HPP_ 17 | 18 | #include 19 | 20 | namespace controller_interface 21 | { 22 | /** 23 | * @brief Resolve the TF prefix with normalized slashes 24 | * @param prefix The TF prefix 25 | * @param node_ns Node namespace to use as prefix if prefix is empty 26 | * @return Prefix to be prepended 27 | */ 28 | inline std::string resolve_tf_prefix(const std::string & prefix, const std::string & node_ns) 29 | { 30 | if (prefix.empty()) 31 | { 32 | return ""; 33 | } 34 | 35 | std::string nprefix = prefix; 36 | std::size_t pos = nprefix.find("~"); 37 | if (pos != std::string::npos) 38 | { 39 | nprefix.replace(pos, 1, node_ns); 40 | } 41 | 42 | // ensure trailing '/' 43 | if (nprefix.back() != '/') 44 | { 45 | nprefix.push_back('/'); 46 | } 47 | // remove leading '/' 48 | if (nprefix.front() == '/') 49 | { 50 | nprefix.erase(0, 1); 51 | } 52 | return nprefix; 53 | } 54 | } // namespace controller_interface 55 | 56 | #endif // CONTROLLER_INTERFACE__TF_PREFIX_HPP_ 57 | -------------------------------------------------------------------------------- /.github/workflows/humble-semi-binary-build.yml: -------------------------------------------------------------------------------- 1 | name: Humble Semi-Binary Build 2 | # author: Denis Štogl 3 | # description: 'Build & test all ros2_control dependencies from source.' 4 | 5 | on: 6 | workflow_dispatch: 7 | pull_request: &event 8 | branches: 9 | - humble 10 | paths: 11 | - '**.hpp' 12 | - '**.h' 13 | - '**.cpp' 14 | - '**.py' 15 | - '**.yaml' 16 | - '.github/workflows/humble-semi-binary-build.yml' 17 | - '**/package.xml' 18 | - '**/CMakeLists.txt' 19 | - 'ros2_control.humble.repos' 20 | push: *event 21 | schedule: 22 | # Run every morning to detect flakiness and broken dependencies 23 | - cron: '03 1 * * MON-FRI' 24 | 25 | concurrency: 26 | # cancel previous runs of the same workflow, except for pushes on given branches 27 | group: ${{ github.workflow }}-${{ github.ref }} 28 | cancel-in-progress: ${{ !startsWith(github.ref, 'refs/heads') }} 29 | 30 | jobs: 31 | semi-binary: 32 | uses: ros-controls/ros2_control_ci/.github/workflows/reusable-industrial-ci-with-cache.yml@master 33 | strategy: 34 | fail-fast: false 35 | matrix: 36 | ROS_DISTRO: [humble] 37 | with: 38 | ros_distro: ${{ matrix.ROS_DISTRO }} 39 | ros_repo: testing 40 | upstream_workspace: ros2_control.${{ matrix.ROS_DISTRO }}.repos 41 | ref_for_scheduled_build: humble 42 | semi-binary-clang: 43 | uses: ros-controls/ros2_control_ci/.github/workflows/reusable-industrial-ci-with-cache.yml@master 44 | with: 45 | ros_distro: humble 46 | ros_repo: testing 47 | upstream_workspace: ros2_control.humble.repos 48 | ref_for_scheduled_build: humble 49 | additional_debs: clang 50 | c_compiler: clang 51 | cxx_compiler: clang++ 52 | not_test_build: true 53 | -------------------------------------------------------------------------------- /rqt_controller_manager/package.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | rqt_controller_manager 5 | 6.2.0 6 | Graphical frontend for interacting with the controller manager. 7 | Bence Magyar 8 | Denis Štogl 9 | Christoph Froehlich 10 | Sai Kishor Kothakota 11 | Apache License 2.0 12 | 13 | http://ros.org/wiki/rqt_controller_manager 14 | https://github.com/ros-controls/ros2_control/issues 15 | https://github.com/ros-controls/ros2_control 16 | 17 | Adolfo Rodríguez Tsouroukdissian 18 | Bence Magyar 19 | Christoph Froehlich 20 | Enrique Fernandez 21 | Kelsey Hawkins 22 | Mathias Lüdtke 23 | 24 | controller_manager 25 | controller_manager_msgs 26 | rclpy 27 | rqt_gui 28 | rqt_gui_py 29 | 30 | 31 | ament_python 32 | 33 | 34 | 35 | -------------------------------------------------------------------------------- /.github/workflows/rolling-pre-release.yml: -------------------------------------------------------------------------------- 1 | name: Rolling - pre-release 2 | # author: Christoph Froehlich 3 | 4 | on: 5 | workflow_dispatch: 6 | inputs: 7 | downstream_depth: 8 | description: 'The depth of the depends-on tree to be included in the overlay workspace (-1 implies unlimited, default: 0)' 9 | required: false 10 | default: 0 11 | type: number 12 | pull_request: 13 | branches: 14 | - master 15 | types: 16 | - opened # default 17 | - reopened # default 18 | - synchronize # default 19 | - labeled # also if a label changes 20 | 21 | jobs: 22 | default: 23 | strategy: 24 | fail-fast: false 25 | matrix: 26 | ROS_DISTRO: [rolling] 27 | 28 | uses: ros-controls/ros2_control_ci/.github/workflows/reusable-prerelease.yml@master 29 | with: 30 | ros_distro: ${{ matrix.ROS_DISTRO }} 31 | # downstream_depth is not set on pull_request event 32 | prerelease_downstream_depth: ${{ github.event_name == 'pull_request' && '0' || inputs.downstream_depth }} 33 | prerelease_exclude_pkg: ackermann_steering_controller admittance_controller bicycle_steering_controller chained_filter_controller diff_drive_controller effort_controllers force_torque_sensor_broadcaster forward_command_controller gpio_controllers gps_sensor_broadcaster imu_sensor_broadcaster joint_state_broadcaster joint_trajectory_controller mecanum_drive_controller motion_primitives_controllers omni_wheel_drive_controller parallel_gripper_controller pid_controller pose_broadcaster position_controllers range_sensor_broadcaster ros2_controllers ros2_controllers_test_nodes rqt_joint_trajectory_controller steering_controllers_library tricycle_controller tricycle_steering_controller velocity_controllers gz_ros2_control gz_ros2_control_demos gz_ros2_control_tests 34 | -------------------------------------------------------------------------------- /.github/mergify.yml: -------------------------------------------------------------------------------- 1 | pull_request_rules: 2 | - name: Backport to humble at reviewers discretion 3 | conditions: 4 | - base=master 5 | - "label=backport-humble" 6 | actions: 7 | backport: 8 | branches: 9 | - humble 10 | 11 | - name: Backport to jazzy at reviewers discretion 12 | conditions: 13 | - base=master 14 | - "label=backport-jazzy" 15 | actions: 16 | backport: 17 | branches: 18 | - jazzy 19 | 20 | - name: Backport to kilted at reviewers discretion 21 | conditions: 22 | - base=master 23 | - "label=backport-kilted" 24 | actions: 25 | backport: 26 | branches: 27 | - kilted 28 | 29 | - name: Ask to resolve conflict 30 | conditions: 31 | - conflict 32 | - author!=mergify[bot] 33 | - author!=dependabot[bot] 34 | actions: 35 | comment: 36 | message: This pull request is in conflict. Could you fix it @{{author}}? 37 | 38 | - name: Ask to resolve conflict for backports 39 | conditions: 40 | - conflict 41 | - author=mergify[bot] 42 | actions: 43 | comment: 44 | message: This pull request is in conflict. Could you fix it @bmagyar @destogl @christophfroehlich @saikishor? 45 | 46 | - name: development targets master branch 47 | conditions: 48 | - base!=master 49 | - author!=bmagyar 50 | - author!=destogl 51 | - author!=christophfroehlich 52 | - author!=saikishor 53 | - author!=mergify[bot] 54 | - author!=dependabot[bot] 55 | actions: 56 | comment: 57 | message: | 58 | @{{author}}, all pull requests must be targeted towards the `master` development branch. 59 | Once merged into `master`, it is possible to backport to `{{base}}`, but it must be in `master` 60 | to have these changes reflected into new distributions. 61 | -------------------------------------------------------------------------------- /hardware_interface_testing/test/test_components/test_components.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Test Actuator 6 | 7 | 8 | 9 | 10 | Test Actuator 11 | 12 | 13 | 14 | 15 | 16 | 17 | Test Sensor 18 | 19 | 20 | 21 | 22 | 23 | Test System 24 | 25 | 26 | 27 | 28 | 29 | Test Uninitializable Actuator 30 | 31 | 32 | 33 | 34 | 35 | Test Uninitializable Sensor 36 | 37 | 38 | 39 | 40 | 41 | Test Uninitializable System 42 | 43 | 44 | 45 | 46 | 47 | Test Actuator with Exclusive Interfaces 48 | 49 | 50 | 51 | -------------------------------------------------------------------------------- /transmission_interface/src/simple_transmission_loader.cpp: -------------------------------------------------------------------------------- 1 | // Copyright 2022 PAL Robotics S.L. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | #include "transmission_interface/simple_transmission_loader.hpp" 16 | 17 | #include 18 | 19 | #include "hardware_interface/hardware_info.hpp" 20 | #include "pluginlib/class_list_macros.hpp" 21 | #include "rclcpp/logging.hpp" 22 | #include "transmission_interface/simple_transmission.hpp" 23 | 24 | namespace transmission_interface 25 | { 26 | std::shared_ptr SimpleTransmissionLoader::load( 27 | const hardware_interface::TransmissionInfo & transmission_info) 28 | { 29 | try 30 | { 31 | const auto mechanical_reduction = transmission_info.joints.at(0).mechanical_reduction; 32 | const auto offset = transmission_info.joints.at(0).offset; 33 | std::shared_ptr transmission( 34 | new SimpleTransmission(mechanical_reduction, offset)); 35 | return transmission; 36 | } 37 | catch (const std::exception & ex) 38 | { 39 | RCLCPP_ERROR( 40 | rclcpp::get_logger("simple_transmission_loader"), "Failed to construct transmission '%s'", 41 | ex.what()); 42 | return std::shared_ptr(); 43 | } 44 | } 45 | 46 | } // namespace transmission_interface 47 | 48 | PLUGINLIB_EXPORT_CLASS( 49 | transmission_interface::SimpleTransmissionLoader, transmission_interface::TransmissionLoader) 50 | -------------------------------------------------------------------------------- /joint_limits/test/joint_saturation_limiter_param.yaml: -------------------------------------------------------------------------------- 1 | joint_saturation_limiter: 2 | ros__parameters: 3 | joint_limits: 4 | # Get full specification from parameter server 5 | foo_joint: 6 | has_position_limits: true 7 | min_position: -5.0 8 | max_position: 5.0 9 | has_velocity_limits: true 10 | max_velocity: 2.0 11 | has_acceleration_limits: true 12 | max_acceleration: 5.0 13 | has_deceleration_limits: true 14 | max_deceleration: 7.5 15 | has_jerk_limits: true 16 | max_jerk: 100.0 17 | has_effort_limits: true 18 | max_effort: 20.0 19 | angle_wraparound: true # should be ignored, has position limits 20 | has_soft_limits: true 21 | k_position: 10.0 22 | k_velocity: 20.0 23 | soft_lower_limit: 0.1 24 | soft_upper_limit: 0.9 25 | 26 | foo_joint_no_effort: 27 | has_position_limits: true 28 | min_position: -5.0 29 | max_position: 5.0 30 | has_velocity_limits: true 31 | max_velocity: 2.0 32 | has_acceleration_limits: true 33 | max_acceleration: 5.0 34 | has_deceleration_limits: true 35 | max_deceleration: 7.5 36 | has_jerk_limits: true 37 | max_jerk: 100.0 38 | has_effort_limits: false 39 | max_effort: 20.0 40 | angle_wraparound: true # should be ignored, has position limits 41 | has_soft_limits: true 42 | k_position: 10.0 43 | k_velocity: 20.0 44 | soft_lower_limit: 0.1 45 | soft_upper_limit: 0.9 46 | 47 | joint_saturation_limiter_nodeclimit: 48 | ros__parameters: 49 | joint_limits: 50 | foo_joint: 51 | has_position_limits: true 52 | min_position: -5.0 53 | max_position: 5.0 54 | has_velocity_limits: true 55 | max_velocity: 2.0 56 | has_acceleration_limits: true 57 | max_acceleration: 5.0 58 | -------------------------------------------------------------------------------- /.github/workflows/rolling-semi-binary-build.yml: -------------------------------------------------------------------------------- 1 | name: Rolling Semi-Binary Build 2 | # author: Denis Štogl 3 | # description: 'Build & test all ros2_control dependencies from source.' 4 | 5 | on: 6 | workflow_dispatch: 7 | pull_request: &event 8 | branches: 9 | - master 10 | paths: 11 | - '**.hpp' 12 | - '**.h' 13 | - '**.cpp' 14 | - '**.py' 15 | - '**.yaml' 16 | - '.github/workflows/rolling-semi-binary-build.yml' 17 | - '**/package.xml' 18 | - '**/CMakeLists.txt' 19 | - 'ros2_control.rolling.repos' 20 | push: *event 21 | schedule: 22 | # Run every morning to detect flakiness and broken dependencies 23 | - cron: '03 1 * * MON-FRI' 24 | 25 | concurrency: 26 | # cancel previous runs of the same workflow, except for pushes on given branches 27 | group: ${{ github.workflow }}-${{ github.ref }} 28 | cancel-in-progress: ${{ !startsWith(github.ref, 'refs/heads') }} 29 | 30 | jobs: 31 | semi-binary: 32 | uses: ros-controls/ros2_control_ci/.github/workflows/reusable-industrial-ci-with-cache.yml@master 33 | strategy: 34 | fail-fast: false 35 | matrix: 36 | ROS_DISTRO: [rolling] 37 | with: 38 | ros_distro: ${{ matrix.ROS_DISTRO }} 39 | ros_repo: testing 40 | upstream_workspace: ros2_control.${{ matrix.ROS_DISTRO }}.repos 41 | ref_for_scheduled_build: master 42 | semi-binary-clang: 43 | uses: ros-controls/ros2_control_ci/.github/workflows/reusable-industrial-ci-with-cache.yml@master 44 | strategy: 45 | fail-fast: false 46 | matrix: 47 | ROS_DISTRO: [rolling] 48 | with: 49 | ros_distro: ${{ matrix.ROS_DISTRO }} 50 | ros_repo: testing 51 | upstream_workspace: ros2_control.${{ matrix.ROS_DISTRO }}.repos 52 | ref_for_scheduled_build: master 53 | additional_debs: clang 54 | c_compiler: clang 55 | cxx_compiler: clang++ 56 | not_test_build: true 57 | -------------------------------------------------------------------------------- /controller_interface/test/test_controller_tf_prefix.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2025, ros2_control developers 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | #include 16 | 17 | #include "controller_interface/tf_prefix.hpp" 18 | #include "test_controller_tf_prefix.hpp" 19 | 20 | TEST_F(TestControllerTFPrefix, EmptyPrefixReturnsEmpty) 21 | { 22 | EXPECT_EQ(controller_interface::resolve_tf_prefix("", "/ns"), ""); 23 | } 24 | 25 | TEST_F(TestControllerTFPrefix, ExplicitPrefixUsed) 26 | { 27 | EXPECT_EQ(controller_interface::resolve_tf_prefix("robot", "/ns"), "robot/"); 28 | } 29 | 30 | TEST_F(TestControllerTFPrefix, NormalizePrefixSlashes) 31 | { 32 | EXPECT_EQ(controller_interface::resolve_tf_prefix("/robot1", "/ns"), "robot1/"); 33 | EXPECT_EQ(controller_interface::resolve_tf_prefix("robot2//", "/ns"), "robot2//"); 34 | EXPECT_EQ(controller_interface::resolve_tf_prefix("/robot3/", "/ns"), "robot3/"); 35 | EXPECT_EQ(controller_interface::resolve_tf_prefix("/", "/ns"), ""); 36 | } 37 | 38 | TEST_F(TestControllerTFPrefix, TildePrefixResolvesToNamespace) 39 | { 40 | EXPECT_EQ(controller_interface::resolve_tf_prefix("~", "/ns"), "ns/"); 41 | EXPECT_EQ(controller_interface::resolve_tf_prefix("~/", "/ns"), "ns/"); 42 | EXPECT_EQ(controller_interface::resolve_tf_prefix("~/robot", "/ns"), "ns/robot/"); 43 | EXPECT_EQ(controller_interface::resolve_tf_prefix("/~/robot/", "ns"), "ns/robot/"); 44 | } 45 | -------------------------------------------------------------------------------- /ros2controlcli/ros2controlcli/verb/unload_controller.py: -------------------------------------------------------------------------------- 1 | # Copyright 2020 PAL Robotics S.L. 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | from controller_manager import unload_controller, bcolors 16 | 17 | from ros2cli.node.direct import add_arguments 18 | from ros2cli.node.strategy import NodeStrategy 19 | from ros2cli.verb import VerbExtension 20 | 21 | from ros2controlcli.api import add_controller_mgr_parsers, LoadedControllerNameCompleter 22 | 23 | 24 | class UnloadControllerVerb(VerbExtension): 25 | """Unload a controller in a controller manager.""" 26 | 27 | def add_arguments(self, parser, cli_name): 28 | add_arguments(parser) 29 | arg = parser.add_argument("controller_name", help="Name of the controller") 30 | arg.completer = LoadedControllerNameCompleter() 31 | add_controller_mgr_parsers(parser) 32 | 33 | def main(self, *, args): 34 | with NodeStrategy(args).direct_node as node: 35 | response = unload_controller(node, args.controller_manager, args.controller_name) 36 | if not response.ok: 37 | print( 38 | f"{bcolors.FAIL}Error unloading controller {args.controller_name}, check controller_manager logs{bcolors.ENDC}" 39 | ) 40 | return 1 41 | 42 | print( 43 | f"{bcolors.OKBLUE}Successfully unloaded controller {args.controller_name}{bcolors.ENDC}" 44 | ) 45 | return 0 46 | -------------------------------------------------------------------------------- /controller_interface/test/test_pose_sensor.hpp: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2024, FZI Forschungszentrum Informatik 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | #ifndef TEST_POSE_SENSOR_HPP_ 16 | #define TEST_POSE_SENSOR_HPP_ 17 | 18 | #include 19 | #include 20 | #include 21 | #include 22 | 23 | #include "gmock/gmock.h" 24 | #include "semantic_components/pose_sensor.hpp" 25 | 26 | class TestablePoseSensor : public semantic_components::PoseSensor 27 | { 28 | FRIEND_TEST(PoseSensorTest, validate_all); 29 | 30 | public: 31 | // Use default interface names 32 | explicit TestablePoseSensor(const std::string & name) : PoseSensor{name} {} 33 | 34 | virtual ~TestablePoseSensor() = default; 35 | }; 36 | 37 | class PoseSensorTest : public ::testing::Test 38 | { 39 | public: 40 | void SetUp(); 41 | void TearDown(); 42 | 43 | protected: 44 | const size_t size_ = 7; 45 | const std::string sensor_name_ = "test_pose_sensor"; 46 | 47 | std::vector full_interface_names_; 48 | const std::vector interface_names_ = { 49 | "position.x", "position.y", "position.z", "orientation.x", 50 | "orientation.y", "orientation.z", "orientation.w"}; 51 | 52 | std::array position_values_ = {{1.1, 2.2, 3.3}}; 53 | std::array orientation_values_ = {{4.4, 5.5, 6.6, 7.7}}; 54 | 55 | std::unique_ptr pose_sensor_; 56 | }; 57 | 58 | #endif // TEST_POSE_SENSOR_HPP_ 59 | -------------------------------------------------------------------------------- /ros2controlcli/ros2controlcli/verb/cleanup_controller.py: -------------------------------------------------------------------------------- 1 | # Copyright 2020 PAL Robotics S.L. 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | from controller_manager import cleanup_controller, bcolors 16 | 17 | from ros2cli.node.direct import add_arguments 18 | from ros2cli.node.strategy import NodeStrategy 19 | from ros2cli.verb import VerbExtension 20 | 21 | from ros2controlcli.api import add_controller_mgr_parsers, LoadedControllerNameCompleter 22 | 23 | 24 | class CleanupControllerVerb(VerbExtension): 25 | """Cleanup a controller in a controller manager.""" 26 | 27 | def add_arguments(self, parser, cli_name): 28 | add_arguments(parser) 29 | arg = parser.add_argument("controller_name", help="Name of the controller") 30 | arg.completer = LoadedControllerNameCompleter() 31 | add_controller_mgr_parsers(parser) 32 | 33 | def main(self, *, args): 34 | with NodeStrategy(args).direct_node as node: 35 | response = cleanup_controller(node, args.controller_manager, args.controller_name) 36 | if not response.ok: 37 | print( 38 | f"{bcolors.FAIL}Error cleaning up controller {args.controller_name}, check controller_manager logs{bcolors.ENDC}" 39 | ) 40 | return 1 41 | 42 | print( 43 | f"{bcolors.OKBLUE}Successfully cleaned up controller {args.controller_name}{bcolors.ENDC}" 44 | ) 45 | return 0 46 | -------------------------------------------------------------------------------- /hardware_interface/include/hardware_interface/types/hardware_interface_return_values.hpp: -------------------------------------------------------------------------------- 1 | // Copyright 2017 Open Source Robotics Foundation, Inc. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | #ifndef HARDWARE_INTERFACE__TYPES__HARDWARE_INTERFACE_RETURN_VALUES_HPP_ 16 | #define HARDWARE_INTERFACE__TYPES__HARDWARE_INTERFACE_RETURN_VALUES_HPP_ 17 | 18 | #include 19 | #include 20 | #include 21 | 22 | namespace hardware_interface 23 | { 24 | enum class return_type : std::uint8_t 25 | { 26 | OK = 0, 27 | ERROR = 1, 28 | DEACTIVATE = 2, 29 | }; 30 | 31 | /** 32 | * Struct to store the status of the Hardware read or write methods return state. 33 | * The status contains information if the cycle was triggered successfully, the result of the 34 | * cycle method and the execution duration of the method. The status is used to provide 35 | * feedback to the controller_manager. 36 | * @var successful: true if it was triggered successfully, false if not. 37 | * @var result: return_type::OK if update is successfully, otherwise return_type::ERROR. 38 | * @var execution_time: duration of the execution of the update method. 39 | */ 40 | struct HardwareComponentCycleStatus 41 | { 42 | bool successful = true; 43 | return_type result = return_type::OK; 44 | std::optional execution_time = std::nullopt; 45 | }; 46 | 47 | } // namespace hardware_interface 48 | 49 | #endif // HARDWARE_INTERFACE__TYPES__HARDWARE_INTERFACE_RETURN_VALUES_HPP_ 50 | -------------------------------------------------------------------------------- /hardware_interface/test/test_macros.cpp: -------------------------------------------------------------------------------- 1 | // Copyright 2017 Open Source Robotics Foundation, Inc. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | #include 16 | 17 | #include "gmock/gmock.h" 18 | #include "hardware_interface/macros.hpp" 19 | 20 | class TestMacros : public ::testing::Test 21 | { 22 | protected: 23 | static void SetUpTestCase() {} 24 | }; 25 | 26 | class A 27 | { 28 | }; 29 | 30 | TEST_F(TestMacros, throw_on_null) 31 | { 32 | int * i_ptr = nullptr; 33 | // cppcheck-suppress unknownMacro 34 | EXPECT_ANY_THROW(THROW_ON_NULLPTR(i_ptr)); 35 | 36 | A * a_ptr = nullptr; 37 | EXPECT_ANY_THROW(THROW_ON_NULLPTR(a_ptr)); 38 | 39 | std::vector vec_ptr(7); 40 | for (auto ptr : vec_ptr) 41 | { 42 | EXPECT_ANY_THROW(THROW_ON_NULLPTR(ptr)); 43 | } 44 | 45 | int ** i_ptr_ptr = &i_ptr; 46 | EXPECT_ANY_THROW(THROW_ON_NULLPTR(*i_ptr_ptr)); 47 | 48 | /* 49 | // undefined behavior 50 | int * i_ptr; 51 | THROW_ON_NULLPTR(i_ptr); 52 | */ 53 | } 54 | 55 | TEST_F(TestMacros, throw_on_not_null) 56 | { 57 | int * i_ptr = new int(); 58 | EXPECT_ANY_THROW(THROW_ON_NOT_NULLPTR(i_ptr)); 59 | 60 | A * a_ptr = new A(); 61 | EXPECT_ANY_THROW(THROW_ON_NOT_NULLPTR(a_ptr)); 62 | 63 | std::vector vec_ptr; 64 | for (size_t i = 0; i < 3; ++i) 65 | { 66 | vec_ptr.push_back(i_ptr); 67 | EXPECT_ANY_THROW(THROW_ON_NOT_NULLPTR(vec_ptr[i])); 68 | } 69 | 70 | int ** i_ptr_ptr = &i_ptr; 71 | EXPECT_ANY_THROW(THROW_ON_NOT_NULLPTR(*i_ptr_ptr)); 72 | 73 | delete a_ptr; 74 | } 75 | -------------------------------------------------------------------------------- /controller_interface/include/semantic_components/range_sensor.hpp: -------------------------------------------------------------------------------- 1 | // Copyright 2023 flochre 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | #ifndef SEMANTIC_COMPONENTS__RANGE_SENSOR_HPP_ 16 | #define SEMANTIC_COMPONENTS__RANGE_SENSOR_HPP_ 17 | 18 | #include 19 | #include 20 | #include 21 | 22 | #include "semantic_components/semantic_component_interface.hpp" 23 | #include "sensor_msgs/msg/range.hpp" 24 | 25 | namespace semantic_components 26 | { 27 | class RangeSensor : public SemanticComponentInterface 28 | { 29 | public: 30 | explicit RangeSensor(const std::string & name) 31 | : SemanticComponentInterface(name, {name + "/" + "range"}) 32 | { 33 | } 34 | /** 35 | * Return Range reported by a sensor 36 | * 37 | * \return value of the range in meters 38 | */ 39 | float get_range() const 40 | { 41 | const auto data = state_interfaces_[0].get().get_optional(); 42 | if (data.has_value()) 43 | { 44 | return data.value(); 45 | } 46 | return std::numeric_limits::quiet_NaN(); 47 | } 48 | 49 | /// Return Range message with range in meters 50 | /** 51 | * Constructs and return a Range message from the current values. 52 | * \return Range message from values; 53 | */ 54 | bool get_values_as_message(sensor_msgs::msg::Range & message) const 55 | { 56 | message.range = get_range(); 57 | return true; 58 | } 59 | }; 60 | 61 | } // namespace semantic_components 62 | 63 | #endif // SEMANTIC_COMPONENTS__RANGE_SENSOR_HPP_ 64 | -------------------------------------------------------------------------------- /controller_interface/test/test_led_rgb_device.hpp: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2024, Sherpa Mobile Robotics 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | #ifndef TEST_LED_RGB_DEVICE_HPP_ 16 | #define TEST_LED_RGB_DEVICE_HPP_ 17 | 18 | #include 19 | #include 20 | #include 21 | #include 22 | #include 23 | 24 | #include "gmock/gmock.h" 25 | #include "semantic_components/led_rgb_device.hpp" 26 | 27 | class TestableLedDevice : public semantic_components::LedRgbDevice 28 | { 29 | FRIEND_TEST(LedDeviceTest, validate_all); 30 | 31 | public: 32 | TestableLedDevice( 33 | const std::string & name, const std::string & interface_r, const std::string & interface_g, 34 | const std::string & interface_b) 35 | : LedRgbDevice{name, interface_r, interface_g, interface_b} 36 | { 37 | } 38 | 39 | virtual ~TestableLedDevice() = default; 40 | }; 41 | 42 | class LedDeviceTest : public ::testing::Test 43 | { 44 | public: 45 | void SetUp(); 46 | void TearDown(); 47 | 48 | protected: 49 | const size_t size_ = 3; 50 | const std::string device_name_ = "test_led_device"; 51 | 52 | std::vector full_cmd_interface_names_; 53 | const std::vector interface_names_ = {"r", "g", "b"}; 54 | 55 | std::array led_values_ = { 56 | {std::numeric_limits::quiet_NaN(), std::numeric_limits::quiet_NaN(), 57 | std::numeric_limits::quiet_NaN()}}; 58 | 59 | std::unique_ptr led_device_; 60 | }; 61 | 62 | #endif // TEST_LED_RGB_DEVICE_HPP_ 63 | -------------------------------------------------------------------------------- /transmission_interface/test/random_generator_utils.hpp: -------------------------------------------------------------------------------- 1 | // Copyright 2020 PAL Robotics S.L. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | /// \author Adolfo Rodriguez Tsouroukdissian 16 | 17 | #ifndef RANDOM_GENERATOR_UTILS_HPP_ 18 | #define RANDOM_GENERATOR_UTILS_HPP_ 19 | 20 | #include 21 | #include 22 | #include 23 | 24 | using std::vector; 25 | 26 | /// \brief Generator of pseudo-random double in the range [min_val, max_val]. 27 | // NOTE: Based on example code available at: 28 | // http://stackoverflow.com/questions/2860673/initializing-a-c-vector-to-random-values-fast 29 | // Use a user specified seed instead of system time for deterministic tests 30 | struct RandomDoubleGenerator 31 | { 32 | public: 33 | RandomDoubleGenerator(double min_val, double max_val, unsigned int seed = 1234) 34 | : min_val_(min_val), max_val_(max_val) 35 | { 36 | srand(seed); 37 | } 38 | double operator()() 39 | { 40 | const double range = max_val_ - min_val_; 41 | return rand() / static_cast(RAND_MAX) * range + min_val_; 42 | } 43 | 44 | private: 45 | double min_val_; 46 | double max_val_; 47 | }; 48 | 49 | /// \brief Generator of a vector of pseudo-random doubles. 50 | vector randomVector(const vector::size_type size, RandomDoubleGenerator & generator) 51 | { 52 | vector out; 53 | out.reserve(size); 54 | for (vector::size_type i = 0; i < size; ++i) 55 | { 56 | out.push_back(generator()); 57 | } 58 | return out; 59 | } 60 | 61 | #endif // RANDOM_GENERATOR_UTILS_HPP_ 62 | -------------------------------------------------------------------------------- /joint_limits/test/joint_limits_rosparam.launch.py: -------------------------------------------------------------------------------- 1 | # Copyright 2020 Open Source Robotics Foundation, Inc. 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | import os 16 | 17 | import unittest 18 | 19 | from ament_index_python.packages import get_package_share_directory 20 | 21 | from launch import LaunchDescription 22 | 23 | from launch_ros.actions import Node 24 | 25 | import launch_testing 26 | import launch_testing.actions 27 | 28 | 29 | def generate_test_description(): 30 | joint_limits_path = get_package_share_directory("joint_limits") 31 | 32 | node_under_test = Node( 33 | package="joint_limits", 34 | executable="joint_limits_rosparam_test", 35 | output="screen", 36 | parameters=[os.path.join(joint_limits_path, "test", "joint_limits_rosparam.yaml")], 37 | ) 38 | return ( 39 | LaunchDescription( 40 | [ 41 | node_under_test, 42 | launch_testing.util.KeepAliveProc(), 43 | launch_testing.actions.ReadyToTest(), 44 | ] 45 | ), 46 | locals(), 47 | ) 48 | 49 | 50 | class TestJointLimitInterface(unittest.TestCase): 51 | def test_termination(self, node_under_test, proc_info): 52 | proc_info.assertWaitForShutdown(process=node_under_test, timeout=(10)) 53 | 54 | 55 | @launch_testing.post_shutdown_test() 56 | class TestJointLimitInterfaceTestAfterShutdown(unittest.TestCase): 57 | def test_exit_code(self, proc_info): 58 | # Check that all processes in the launch (in this case, there's just one) exit 59 | # with code 0 60 | launch_testing.asserts.assertExitCodes(proc_info) 61 | -------------------------------------------------------------------------------- /rqt_controller_manager/rqt_controller_manager/update_combo.py: -------------------------------------------------------------------------------- 1 | # Copyright 2021 PAL Robotics S.L. 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | 16 | def update_combo(combo, new_vals): 17 | """ 18 | Update the contents of a combo box with a set of new values. 19 | 20 | If the previously selected element is still present in the new values, it 21 | will remain as active selection, even if its index has changed. This will 22 | not trigger any signal. 23 | 24 | If the previously selected element is no longer present in the new values, 25 | the combo will unset its selection. This will trigger signals for changed 26 | element. 27 | """ 28 | selected_val = combo.currentText() 29 | old_vals = [combo.itemText(i) for i in range(combo.count())] 30 | 31 | # Check if combo items changed 32 | if not _is_permutation(old_vals, new_vals): 33 | # Determine if selected value is in the new list 34 | selected_id = -1 35 | try: 36 | selected_id = new_vals.index(selected_val) 37 | except ValueError: 38 | combo.setCurrentIndex(-1) 39 | 40 | # Re-populate items 41 | combo.blockSignals(True) # No need to notify these changes 42 | combo.clear() 43 | combo.insertItems(0, new_vals) 44 | combo.setCurrentIndex(selected_id) # Restore selection 45 | combo.blockSignals(False) 46 | 47 | 48 | def _is_permutation(a, b): 49 | """ 50 | Return true if a is a permutation of b, false otherwise. 51 | 52 | @type a [] 53 | @type b [] 54 | @return True if C{a} is a permutation of C{b}, false otherwise 55 | @rtype bool 56 | """ 57 | return set(a) == set(b) 58 | -------------------------------------------------------------------------------- /hardware_interface/include/hardware_interface/types/hardware_component_interface_params.hpp: -------------------------------------------------------------------------------- 1 | // Copyright 2025 ros2_control Development Team 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | #ifndef HARDWARE_INTERFACE__TYPES__HARDWARE_COMPONENT_INTERFACE_PARAMS_HPP_ 16 | #define HARDWARE_INTERFACE__TYPES__HARDWARE_COMPONENT_INTERFACE_PARAMS_HPP_ 17 | 18 | #include 19 | #include "hardware_interface/hardware_info.hpp" 20 | #include "hardware_interface/types/hardware_component_params.hpp" 21 | #include "rclcpp/rclcpp.hpp" 22 | 23 | namespace hardware_interface 24 | { 25 | 26 | /** 27 | * @brief Parameters required for the initialization of a specific hardware component plugin. 28 | * Typically used for on_init methods of hardware interfaces, and is parsed by the user. 29 | * This struct is typically populated with data from HardwareComponentParams from each component. 30 | */ 31 | struct HardwareComponentInterfaceParams 32 | { 33 | HardwareComponentInterfaceParams() = default; 34 | /** 35 | * @brief Reference to the HardwareInfo struct for this specific component, 36 | * parsed from the URDF. The HardwareInfo object's lifetime must be guaranteed 37 | * by the caller (e.g., ResourceManager) for the duration this struct is used. 38 | */ 39 | hardware_interface::HardwareInfo hardware_info; 40 | 41 | /** 42 | * @brief Weak pointer to the rclcpp::Executor instance. Hardware components 43 | * can use this (after locking) to add their own internal ROS 2 nodes 44 | * to the ControllerManager's executor. 45 | */ 46 | rclcpp::Executor::WeakPtr executor; 47 | }; 48 | 49 | } // namespace hardware_interface 50 | 51 | #endif // HARDWARE_INTERFACE__TYPES__HARDWARE_COMPONENT_INTERFACE_PARAMS_HPP_ 52 | -------------------------------------------------------------------------------- /controller_interface/test/test_magnetic_field_sensor.hpp: -------------------------------------------------------------------------------- 1 | // Copyright 2025 Aarav Gupta 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | #ifndef TEST_MAGNETIC_FIELD_SENSOR_HPP_ 16 | #define TEST_MAGNETIC_FIELD_SENSOR_HPP_ 17 | 18 | #include 19 | #include 20 | #include 21 | 22 | #include "gmock/gmock.h" 23 | #include "semantic_components/magnetic_field_sensor.hpp" 24 | 25 | // implementing and friending so we can access member variables 26 | class TestableMagneticFieldSensor : public semantic_components::MagneticFieldSensor 27 | { 28 | FRIEND_TEST(MagneticFieldSensorTest, validate_all); 29 | 30 | public: 31 | // Use generation of interface names 32 | explicit TestableMagneticFieldSensor(const std::string & name) : MagneticFieldSensor(name) {} 33 | 34 | virtual ~TestableMagneticFieldSensor() = default; 35 | }; 36 | 37 | class MagneticFieldSensorTest : public ::testing::Test 38 | { 39 | public: 40 | void SetUp() 41 | { 42 | full_interface_names_.reserve(size_); 43 | for (auto index = 0u; index < size_; ++index) 44 | { 45 | full_interface_names_.emplace_back( 46 | sensor_name_ + "/" + magnetic_field_interface_names_[index]); 47 | } 48 | } 49 | 50 | void TearDown(); 51 | 52 | protected: 53 | const size_t size_ = 3; 54 | const std::string sensor_name_ = "test_magnetometer"; 55 | std::array magnetic_field_values_ = {{4.4, 5.5, 6.6}}; 56 | std::unique_ptr magnetic_field_sensor_; 57 | 58 | std::vector full_interface_names_; 59 | const std::vector magnetic_field_interface_names_ = { 60 | "magnetic_field.x", "magnetic_field.y", "magnetic_field.z"}; 61 | }; 62 | 63 | #endif // TEST_MAGNETIC_FIELD_SENSOR_HPP_ 64 | -------------------------------------------------------------------------------- /controller_interface/include/controller_interface/controller_interface.hpp: -------------------------------------------------------------------------------- 1 | // Copyright 2017 Open Source Robotics Foundation, Inc. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | #ifndef CONTROLLER_INTERFACE__CONTROLLER_INTERFACE_HPP_ 16 | #define CONTROLLER_INTERFACE__CONTROLLER_INTERFACE_HPP_ 17 | 18 | #include 19 | #include 20 | 21 | #include "controller_interface/controller_interface_base.hpp" 22 | #include "hardware_interface/handle.hpp" 23 | 24 | namespace controller_interface 25 | { 26 | class ControllerInterface : public controller_interface::ControllerInterfaceBase 27 | { 28 | public: 29 | ControllerInterface(); 30 | 31 | virtual ~ControllerInterface() = default; 32 | 33 | /** 34 | * Controller is not chainable. 35 | * 36 | * \returns false. 37 | */ 38 | bool is_chainable() const final; 39 | 40 | /** 41 | * A non-chainable controller doesn't export any state interfaces. 42 | * 43 | * \returns empty list. 44 | */ 45 | std::vector export_state_interfaces() final; 46 | 47 | /** 48 | * Controller has no reference interfaces. 49 | * 50 | * \returns empty list. 51 | */ 52 | std::vector export_reference_interfaces() final; 53 | 54 | /** 55 | * Controller is not chainable, therefore no chained mode can be set. 56 | * 57 | * \returns false. 58 | */ 59 | bool set_chained_mode(bool chained_mode) final; 60 | 61 | /** 62 | * Controller can not be in chained mode. 63 | * 64 | * \returns false. 65 | */ 66 | bool is_in_chained_mode() const final; 67 | }; 68 | 69 | using ControllerInterfaceSharedPtr = std::shared_ptr; 70 | 71 | } // namespace controller_interface 72 | 73 | #endif // CONTROLLER_INTERFACE__CONTROLLER_INTERFACE_HPP_ 74 | -------------------------------------------------------------------------------- /hardware_interface_testing/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.16) 2 | project(hardware_interface_testing LANGUAGES CXX) 3 | 4 | find_package(ros2_control_cmake REQUIRED) 5 | set_compiler_options() 6 | export_windows_symbols() 7 | 8 | set(THIS_PACKAGE_INCLUDE_DEPENDS 9 | hardware_interface 10 | lifecycle_msgs 11 | pluginlib 12 | rclcpp_lifecycle 13 | ros2_control_test_assets 14 | fmt 15 | ) 16 | 17 | find_package(ament_cmake REQUIRED) 18 | foreach(Dependency IN ITEMS ${THIS_PACKAGE_INCLUDE_DEPENDS}) 19 | find_package(${Dependency} REQUIRED) 20 | endforeach() 21 | 22 | add_library(test_components SHARED 23 | test/test_components/test_actuator.cpp 24 | test/test_components/test_sensor.cpp 25 | test/test_components/test_system.cpp 26 | test/test_components/test_actuator_exclusive_interfaces.cpp) 27 | 28 | target_link_libraries(test_components 29 | hardware_interface::hardware_interface 30 | rclcpp_lifecycle::rclcpp_lifecycle 31 | ros2_control_test_assets::ros2_control_test_assets 32 | pluginlib::pluginlib 33 | fmt::fmt) 34 | install(TARGETS test_components 35 | DESTINATION lib 36 | ) 37 | pluginlib_export_plugin_description_file( 38 | hardware_interface test/test_components/test_components.xml) 39 | 40 | if(BUILD_TESTING) 41 | 42 | find_package(ament_cmake_gmock REQUIRED) 43 | 44 | ament_add_gmock(test_resource_manager test/test_resource_manager.cpp) 45 | target_link_libraries(test_resource_manager 46 | hardware_interface::hardware_interface 47 | rclcpp_lifecycle::rclcpp_lifecycle 48 | ros2_control_test_assets::ros2_control_test_assets 49 | ${lifecycle_msgs_TARGETS}) 50 | 51 | ament_add_gmock(test_resource_manager_prepare_perform_switch test/test_resource_manager_prepare_perform_switch.cpp) 52 | target_link_libraries(test_resource_manager_prepare_perform_switch 53 | hardware_interface::hardware_interface 54 | rclcpp_lifecycle::rclcpp_lifecycle 55 | ros2_control_test_assets::ros2_control_test_assets 56 | ${lifecycle_msgs_TARGETS}) 57 | 58 | endif() 59 | 60 | ament_export_dependencies(${THIS_PACKAGE_INCLUDE_DEPENDS}) 61 | ament_package() 62 | -------------------------------------------------------------------------------- /controller_manager/include/controller_manager/controller_spec.hpp: -------------------------------------------------------------------------------- 1 | // Copyright 2020 Open Source Robotics Foundation, Inc. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | /* 16 | * Author: Wim Meeussen 17 | */ 18 | 19 | #ifndef CONTROLLER_MANAGER__CONTROLLER_SPEC_HPP_ 20 | #define CONTROLLER_MANAGER__CONTROLLER_SPEC_HPP_ 21 | 22 | #include 23 | #include 24 | #include 25 | #include "controller_interface/controller_interface_base.hpp" 26 | #include "hardware_interface/controller_info.hpp" 27 | #include "hardware_interface/types/statistics_types.hpp" 28 | 29 | namespace controller_manager 30 | { 31 | 32 | using MovingAverageStatistics = ros2_control::MovingAverageStatistics; 33 | /// Controller Specification 34 | /** 35 | * This struct contains both a pointer to a given controller, \ref c, as well 36 | * as information about the controller, \ref info. 37 | * 38 | */ 39 | struct ControllerSpec 40 | { 41 | ControllerSpec() 42 | { 43 | last_update_cycle_time = std::make_shared(0, 0, RCL_CLOCK_UNINITIALIZED); 44 | execution_time_statistics = std::make_shared(); 45 | periodicity_statistics = std::make_shared(); 46 | } 47 | 48 | hardware_interface::ControllerInfo info; 49 | controller_interface::ControllerInterfaceBaseSharedPtr c; 50 | std::shared_ptr last_update_cycle_time; 51 | std::vector controllers_chain_group = {}; 52 | std::shared_ptr execution_time_statistics; 53 | std::shared_ptr periodicity_statistics; 54 | }; 55 | 56 | struct ControllerChainSpec 57 | { 58 | std::vector following_controllers; 59 | std::vector preceding_controllers; 60 | }; 61 | } // namespace controller_manager 62 | #endif // CONTROLLER_MANAGER__CONTROLLER_SPEC_HPP_ 63 | -------------------------------------------------------------------------------- /transmission_interface/src/differential_transmission_loader.cpp: -------------------------------------------------------------------------------- 1 | // Copyright 2022 PAL Robotics S.L. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | #include "transmission_interface/differential_transmission_loader.hpp" 16 | 17 | #include 18 | 19 | #include "hardware_interface/hardware_info.hpp" 20 | #include "pluginlib/class_list_macros.hpp" 21 | #include "rclcpp/logging.hpp" 22 | #include "transmission_interface/differential_transmission.hpp" 23 | 24 | namespace transmission_interface 25 | { 26 | std::shared_ptr DifferentialTransmissionLoader::load( 27 | const hardware_interface::TransmissionInfo & transmission_info) 28 | { 29 | try 30 | { 31 | const auto act_reduction1 = transmission_info.actuators.at(0).mechanical_reduction; 32 | const auto act_reduction2 = transmission_info.actuators.at(1).mechanical_reduction; 33 | 34 | const auto jnt_reduction1 = transmission_info.joints.at(0).mechanical_reduction; 35 | const auto jnt_reduction2 = transmission_info.joints.at(1).mechanical_reduction; 36 | 37 | const auto jnt_offset1 = transmission_info.joints.at(0).offset; 38 | const auto jnt_offset2 = transmission_info.joints.at(1).offset; 39 | 40 | std::shared_ptr transmission(new DifferentialTransmission( 41 | {act_reduction1, act_reduction2}, {jnt_reduction1, jnt_reduction2}, 42 | {jnt_offset1, jnt_offset2})); 43 | return transmission; 44 | } 45 | catch (const std::exception & ex) 46 | { 47 | RCLCPP_ERROR( 48 | rclcpp::get_logger("differential_transmission_loader"), 49 | "Failed to construct transmission '%s'", ex.what()); 50 | return std::shared_ptr(); 51 | } 52 | } 53 | 54 | } // namespace transmission_interface 55 | 56 | PLUGINLIB_EXPORT_CLASS( 57 | transmission_interface::DifferentialTransmissionLoader, 58 | transmission_interface::TransmissionLoader) 59 | -------------------------------------------------------------------------------- /transmission_interface/src/four_bar_linkage_transmission_loader.cpp: -------------------------------------------------------------------------------- 1 | // Copyright 2022 PAL Robotics S.L. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | #include "transmission_interface/four_bar_linkage_transmission_loader.hpp" 16 | 17 | #include 18 | 19 | #include "hardware_interface/hardware_info.hpp" 20 | #include "pluginlib/class_list_macros.hpp" 21 | #include "rclcpp/logging.hpp" 22 | #include "transmission_interface/four_bar_linkage_transmission.hpp" 23 | 24 | namespace transmission_interface 25 | { 26 | std::shared_ptr FourBarLinkageTransmissionLoader::load( 27 | const hardware_interface::TransmissionInfo & transmission_info) 28 | { 29 | try 30 | { 31 | const auto act_reduction1 = transmission_info.actuators.at(0).mechanical_reduction; 32 | const auto act_reduction2 = transmission_info.actuators.at(1).mechanical_reduction; 33 | 34 | const auto jnt_reduction1 = transmission_info.joints.at(0).mechanical_reduction; 35 | const auto jnt_reduction2 = transmission_info.joints.at(1).mechanical_reduction; 36 | 37 | const auto jnt_offset1 = transmission_info.joints.at(0).offset; 38 | const auto jnt_offset2 = transmission_info.joints.at(1).offset; 39 | 40 | std::shared_ptr transmission(new FourBarLinkageTransmission( 41 | {act_reduction1, act_reduction2}, {jnt_reduction1, jnt_reduction2}, 42 | {jnt_offset1, jnt_offset2})); 43 | return transmission; 44 | } 45 | catch (const std::exception & ex) 46 | { 47 | RCLCPP_ERROR( 48 | rclcpp::get_logger("four_bar_linkage_transmission_loader"), 49 | "Failed to construct transmission '%s'", ex.what()); 50 | return std::shared_ptr(); 51 | } 52 | } 53 | 54 | } // namespace transmission_interface 55 | 56 | PLUGINLIB_EXPORT_CLASS( 57 | transmission_interface::FourBarLinkageTransmissionLoader, 58 | transmission_interface::TransmissionLoader) 59 | -------------------------------------------------------------------------------- /transmission_interface/include/transmission_interface/accessor.hpp: -------------------------------------------------------------------------------- 1 | // Copyright 2020 PAL Robotics S.L. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | #ifndef TRANSMISSION_INTERFACE__ACCESSOR_HPP_ 16 | #define TRANSMISSION_INTERFACE__ACCESSOR_HPP_ 17 | 18 | #include 19 | #include 20 | #include 21 | #include 22 | #include 23 | 24 | namespace transmission_interface 25 | { 26 | template 27 | std::string to_string(const std::vector & list) 28 | { 29 | std::stringstream ss; 30 | ss << "["; 31 | for (const auto & elem : list) 32 | { 33 | ss << elem << ", "; 34 | } 35 | 36 | if (!list.empty()) 37 | { 38 | ss.seekp(-2, std::ios_base::end); // remove last ", " 39 | } 40 | ss << "]"; 41 | return ss.str(); 42 | } 43 | 44 | template 45 | std::vector get_names(const std::vector & handles) 46 | { 47 | std::set names; 48 | std::transform( 49 | handles.cbegin(), handles.cend(), std::inserter(names, names.end()), 50 | [](const auto & handle) { return handle.get_prefix_name(); }); 51 | return std::vector(names.begin(), names.end()); 52 | } 53 | 54 | template 55 | std::vector get_ordered_handles( 56 | const std::vector & unordered_handles, const std::vector & names, 57 | const std::string & interface_type) 58 | { 59 | std::vector result; 60 | for (const auto & name : names) 61 | { 62 | std::copy_if( 63 | unordered_handles.cbegin(), unordered_handles.cend(), std::back_inserter(result), 64 | [&](const auto & handle) 65 | { 66 | return (handle.get_prefix_name() == name) && 67 | (handle.get_interface_name() == interface_type) && handle; 68 | }); 69 | } 70 | return result; 71 | } 72 | 73 | } // namespace transmission_interface 74 | 75 | #endif // TRANSMISSION_INTERFACE__ACCESSOR_HPP_ 76 | -------------------------------------------------------------------------------- /controller_interface/test/test_semantic_component_command_interface.hpp: -------------------------------------------------------------------------------- 1 | // Copyright 2024 Sherpa Mobile Robotics 2 | // Licensed under the Apache License, Version 2.0 (the "License"); 3 | // you may not use this file except in compliance with the License. 4 | // You may obtain a copy of the License at 5 | // 6 | // http://www.apache.org/licenses/LICENSE-2.0 7 | // 8 | // Unless required by applicable law or agreed to in writing, software 9 | // distributed under the License is distributed on an "AS IS" BASIS, 10 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11 | // See the License for the specific language governing permissions and 12 | // limitations under the License. 13 | 14 | /* 15 | * Authors: Thibault Poignonec 16 | */ 17 | 18 | #ifndef TEST_SEMANTIC_COMPONENT_COMMAND_INTERFACE_HPP_ 19 | #define TEST_SEMANTIC_COMPONENT_COMMAND_INTERFACE_HPP_ 20 | 21 | #include 22 | #include 23 | 24 | #include "geometry_msgs/msg/pose.hpp" 25 | #include "gmock/gmock.h" 26 | #include "semantic_components/semantic_component_command_interface.hpp" 27 | 28 | // implementing and friending so we can access member variables 29 | class TestableSemanticCommandInterface 30 | : public semantic_components::SemanticComponentCommandInterface 31 | { 32 | FRIEND_TEST(SemanticCommandInterfaceTest, validate_custom_names); 33 | FRIEND_TEST(SemanticCommandInterfaceTest, validate_command_interfaces); 34 | 35 | public: 36 | explicit TestableSemanticCommandInterface(const std::string & name) 37 | : SemanticComponentCommandInterface(name, {name + "/1", name + "/2", name + "/3"}) 38 | { 39 | } 40 | 41 | virtual ~TestableSemanticCommandInterface() = default; 42 | 43 | // We are not testing the implementation of the function, so we simply return false. 44 | // Note that set_values_from_message is a pure virtual function, hence the need for this 45 | bool set_values_from_message(const geometry_msgs::msg::Pose & /* message */) override 46 | { 47 | return false; 48 | } 49 | 50 | std::string test_name_ = "TestSemanticCommandInterface"; 51 | }; 52 | 53 | class SemanticCommandInterfaceTest : public ::testing::Test 54 | { 55 | public: 56 | void TearDown(); 57 | 58 | protected: 59 | const std::string component_name_ = "test_component"; 60 | const size_t size_ = 3; 61 | std::unique_ptr semantic_component_; 62 | }; 63 | 64 | #endif // TEST_SEMANTIC_COMPONENT_COMMAND_INTERFACE_HPP_ 65 | -------------------------------------------------------------------------------- /controller_interface/test/test_controller_interface.hpp: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2022, Stogl Robotics Consulting UG (haftungsbeschränkt) 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | #ifndef TEST_CONTROLLER_INTERFACE_HPP_ 16 | #define TEST_CONTROLLER_INTERFACE_HPP_ 17 | 18 | #include "controller_interface/controller_interface.hpp" 19 | 20 | constexpr char TEST_CONTROLLER_NAME[] = "testable_controller_interface"; 21 | 22 | class TestableControllerInterface : public controller_interface::ControllerInterface 23 | { 24 | public: 25 | controller_interface::CallbackReturn on_init() override 26 | { 27 | return controller_interface::CallbackReturn::SUCCESS; 28 | } 29 | 30 | controller_interface::InterfaceConfiguration command_interface_configuration() const override 31 | { 32 | return controller_interface::InterfaceConfiguration{ 33 | controller_interface::interface_configuration_type::NONE}; 34 | } 35 | 36 | controller_interface::InterfaceConfiguration state_interface_configuration() const override 37 | { 38 | return controller_interface::InterfaceConfiguration{ 39 | controller_interface::interface_configuration_type::NONE}; 40 | } 41 | 42 | controller_interface::return_type update( 43 | const rclcpp::Time & /*time*/, const rclcpp::Duration & /*period*/) override 44 | { 45 | return controller_interface::return_type::OK; 46 | } 47 | }; 48 | 49 | class TestableControllerInterfaceInitError : public TestableControllerInterface 50 | { 51 | public: 52 | controller_interface::CallbackReturn on_init() override 53 | { 54 | return controller_interface::CallbackReturn::ERROR; 55 | } 56 | }; 57 | 58 | class TestableControllerInterfaceInitFailure : public TestableControllerInterface 59 | { 60 | public: 61 | controller_interface::CallbackReturn on_init() override 62 | { 63 | return controller_interface::CallbackReturn::FAILURE; 64 | } 65 | }; 66 | 67 | #endif // TEST_CONTROLLER_INTERFACE_HPP_ 68 | --------------------------------------------------------------------------------