Skip to content

Commit

Permalink
Merge branch 'master' into add-simple-joint-limiter
Browse files Browse the repository at this point in the history
  • Loading branch information
destogl authored Nov 21, 2023
2 parents 4f868b1 + d2ee835 commit 72b1ea7
Show file tree
Hide file tree
Showing 55 changed files with 574 additions and 549 deletions.
9 changes: 9 additions & 0 deletions .github/mergify.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,15 @@ pull_request_rules:
branches:
- humble

- name: Backport to iron at reviewers discretion
conditions:
- base=master
- "label=backport-iron"
actions:
backport:
branches:
- iron

- name: Ask to resolve conflict
conditions:
- conflict
Expand Down
8 changes: 1 addition & 7 deletions .github/workflows/ci-coverage-build.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
name: Coverage Build
on:
workflow_dispatch:
branches:
- master
push:
branches:
- master
Expand All @@ -23,19 +21,15 @@ jobs:
with:
required-ros-distributions: ${{ env.ROS_DISTRO }}
- uses: actions/checkout@v4
- uses: ros-tooling/action-ros-ci@0.3.4
- uses: ros-tooling/action-ros-ci@0.3.5
with:
target-ros2-distro: ${{ env.ROS_DISTRO }}
import-token: ${{ secrets.GITHUB_TOKEN }}
# build all packages listed in the meta package
package-name:
controller_interface
controller_manager
controller_manager_msgs
hardware_interface
ros2controlcli
ros2_control
ros2_control_test_assets
transmission_interface

vcs-repo-file-url: |
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/iron-abi-compatibility.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@ name: Iron - ABI Compatibility Check
on:
workflow_dispatch:
branches:
- master
- iron
pull_request:
branches:
- master
- iron

jobs:
abi_check:
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/iron-binary-build-main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@ name: Iron Binary Build - main
on:
workflow_dispatch:
branches:
- master
- iron
pull_request:
branches:
- master
- iron
push:
branches:
- master
- iron
schedule:
# Run every morning to detect flakiness and broken dependencies
- cron: '03 1 * * *'
Expand All @@ -23,4 +23,4 @@ jobs:
ros_distro: iron
ros_repo: main
upstream_workspace: ros2_control-not-released.iron.repos
ref_for_scheduled_build: master
ref_for_scheduled_build: iron
8 changes: 4 additions & 4 deletions .github/workflows/iron-binary-build-testing.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@ name: Iron Binary Build - testing
on:
workflow_dispatch:
branches:
- master
- iron
pull_request:
branches:
- master
- iron
push:
branches:
- master
- iron
schedule:
# Run every morning to detect flakiness and broken dependencies
- cron: '03 1 * * *'
Expand All @@ -23,4 +23,4 @@ jobs:
ros_distro: iron
ros_repo: testing
upstream_workspace: ros2_control-not-released.iron.repos
ref_for_scheduled_build: master
ref_for_scheduled_build: iron
8 changes: 4 additions & 4 deletions .github/workflows/iron-semi-binary-build-main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@ name: Iron Semi-Binary Build - main
on:
workflow_dispatch:
branches:
- master
- iron
pull_request:
branches:
- master
- iron
push:
branches:
- master
- iron
schedule:
# Run every morning to detect flakiness and broken dependencies
- cron: '33 1 * * *'
Expand All @@ -22,4 +22,4 @@ jobs:
ros_distro: iron
ros_repo: main
upstream_workspace: ros2_control.iron.repos
ref_for_scheduled_build: master
ref_for_scheduled_build: iron
8 changes: 4 additions & 4 deletions .github/workflows/iron-semi-binary-build-testing.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@ name: Iron Semi-Binary Build - testing
on:
workflow_dispatch:
branches:
- master
- iron
pull_request:
branches:
- master
- iron
push:
branches:
- master
- iron
schedule:
# Run every morning to detect flakiness and broken dependencies
- cron: '33 1 * * *'
Expand All @@ -22,4 +22,4 @@ jobs:
ros_distro: iron
ros_repo: testing
upstream_workspace: ros2_control.iron.repos
ref_for_scheduled_build: master
ref_for_scheduled_build: iron
6 changes: 3 additions & 3 deletions .github/workflows/iron-source-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@ name: Iron Source Build
on:
workflow_dispatch:
branches:
- master
- iron
push:
branches:
- master
- iron
schedule:
# Run every day to detect flakiness and broken dependencies
- cron: '03 3 * * *'
Expand All @@ -15,5 +15,5 @@ jobs:
uses: ./.github/workflows/reusable-ros-tooling-source-build.yml
with:
ros_distro: iron
ref: master
ref: iron
ros2_repo_branch: iron
2 changes: 1 addition & 1 deletion .github/workflows/reusable-ros-tooling-source-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ jobs:
- uses: actions/checkout@v4
with:
ref: ${{ inputs.ref }}
- uses: ros-tooling/action-ros-ci@0.3.4
- uses: ros-tooling/action-ros-ci@0.3.5
with:
target-ros2-distro: ${{ inputs.ros_distro }}
# build all packages listed in the meta package
Expand Down
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# ros2_control

[![Licence](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)
[![codecov](https://codecov.io/gh/ros-controls/ros2_control/graph/badge.svg?token=idvm1zJXOf)](https://codecov.io/gh/ros-controls/ros2_control)

This package is a part of the ros2_control framework.
For more, please check the [documentation](https://control.ros.org/).
Expand All @@ -11,7 +12,7 @@ For more, please check the [documentation](https://control.ros.org/).
ROS2 Distro | Branch | Build status | Documentation | Released packages
:---------: | :----: | :----------: | :-----------: | :---------------:
**Rolling** | [`master`](https://github.com/ros-controls/ros2_control/tree/master) | [![Rolling Binary Build](https://github.com/ros-controls/ros2_control/actions/workflows/rolling-binary-build-main.yml/badge.svg?branch=master)](https://github.com/ros-controls/ros2_control/actions/workflows/rolling-binary-build-main.yml?branch=master) <br /> [![Rolling Semi-Binary Build](https://github.com/ros-controls/ros2_control/actions/workflows/rolling-semi-binary-build-main.yml/badge.svg?branch=master)](https://github.com/ros-controls/ros2_control/actions/workflows/rolling-semi-binary-build-main.yml?branch=master) | [Documentation](https://control.ros.org/master/index.html) <br /> [API Reference](https://control.ros.org/master/doc/api/index.html) | [ros2_control](https://index.ros.org/p/ros2_control/#rolling)
**Iron** | [`master`](https://github.com/ros-controls/ros2_control/tree/master) | [![Iron Binary Build](https://github.com/ros-controls/ros2_control/actions/workflows/iron-binary-build-main.yml/badge.svg?branch=master)](https://github.com/ros-controls/ros2_control/actions/workflows/iron-binary-build-main.yml?branch=master) <br /> [![Iron Semi-Binary Build](https://github.com/ros-controls/ros2_control/actions/workflows/iron-semi-binary-build-main.yml/badge.svg?branch=master)](https://github.com/ros-controls/ros2_control/actions/workflows/iron-semi-binary-build-main.yml?branch=master) | [Documentation](https://control.ros.org/master/index.html) <br /> [API Reference](https://control.ros.org/master/doc/api/index.html) | [ros2_control](https://index.ros.org/p/ros2_control/#iron)
**Iron** | [`iron`](https://github.com/ros-controls/ros2_control/tree/iron) | [![Iron Binary Build](https://github.com/ros-controls/ros2_control/actions/workflows/iron-binary-build-main.yml/badge.svg?branch=iron)](https://github.com/ros-controls/ros2_control/actions/workflows/iron-binary-build-main.yml?branch=iron) <br /> [![Iron Semi-Binary Build](https://github.com/ros-controls/ros2_control/actions/workflows/iron-semi-binary-build-main.yml/badge.svg?branch=iron)](https://github.com/ros-controls/ros2_control/actions/workflows/iron-semi-binary-build-main.yml?branch=iron) | [Documentation](https://control.ros.org/iron/index.html) <br /> [API Reference](https://control.ros.org/iron/doc/api/index.html) | [ros2_control](https://index.ros.org/p/ros2_control/#iron)
**Humble** | [`humble`](https://github.com/ros-controls/ros2_control/tree/humble) | [![Humble Binary Build](https://github.com/ros-controls/ros2_control/actions/workflows/humble-binary-build-main.yml/badge.svg?branch=master)](https://github.com/ros-controls/ros2_control/actions/workflows/humble-binary-build-main.yml?branch=master) <br /> [![Humble Semi-Binary Build](https://github.com/ros-controls/ros2_control/actions/workflows/humble-semi-binary-build-main.yml/badge.svg?branch=master)](https://github.com/ros-controls/ros2_control/actions/workflows/humble-semi-binary-build-main.yml?branch=master) | [Documentation](https://control.ros.org/humble/index.html) <br /> [API Reference](https://control.ros.org/humble/doc/api/index.html) | [ros2_control](https://index.ros.org/p/ros2_control/#humble)

[Detailed build status](.github/workflows/README.md)
Expand Down
4 changes: 2 additions & 2 deletions codecov.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,12 @@ fixes:
comment:
layout: "diff, flags, files"
behavior: default
ignore:
- "**/test"
flags:
unittests:
paths:
- controller_interface
- controller_manager
- hardware_interface
- joint_limits_interface
- test_robot_hardware
- transmission_interface
9 changes: 9 additions & 0 deletions controller_interface/CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,15 @@
Changelog for package controller_interface
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

4.0.0 (2023-11-21)
------------------
* Pass controller manager update rate on the init of the controller interface (`#1141 <https://github.com/ros-controls/ros2_control/issues/1141>`_)
* Pass URDF to controllers on init (`#1088 <https://github.com/ros-controls/ros2_control/issues/1088>`_)
* Contributors: Bence Magyar, Sai Kishor Kothakota

3.21.0 (2023-11-06)
-------------------

3.20.0 (2023-10-31)
-------------------

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,8 @@ class ControllerInterfaceBase : public rclcpp_lifecycle::node_interfaces::Lifecy

CONTROLLER_INTERFACE_PUBLIC
virtual return_type init(
const std::string & controller_name, const std::string & namespace_ = "",
const std::string & controller_name, const std::string & urdf, unsigned int cm_update_rate,
const std::string & namespace_ = "",
const rclcpp::NodeOptions & node_options = rclcpp::NodeOptions().enable_logger_service(true));

/// Custom configure method to read additional parameters for controller-nodes
Expand Down Expand Up @@ -155,6 +156,9 @@ class ControllerInterfaceBase : public rclcpp_lifecycle::node_interfaces::Lifecy
CONTROLLER_INTERFACE_PUBLIC
bool is_async() const;

CONTROLLER_INTERFACE_PUBLIC
const std::string & get_robot_description() const;

/// Declare and initialize a parameter with a type.
/**
*
Expand Down Expand Up @@ -223,6 +227,7 @@ class ControllerInterfaceBase : public rclcpp_lifecycle::node_interfaces::Lifecy
std::vector<hardware_interface::LoanedStateInterface> state_interfaces_;
unsigned int update_rate_ = 0;
bool is_async_ = false;
std::string urdf_ = "";

private:
std::shared_ptr<rclcpp_lifecycle::LifecycleNode> node_;
Expand Down
2 changes: 1 addition & 1 deletion controller_interface/package.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<?xml-model href="http://download.ros.org/schema/package_format2.xsd" schematypens="http://www.w3.org/2001/XMLSchema"?>
<package format="2">
<name>controller_interface</name>
<version>3.20.0</version>
<version>4.0.0</version>
<description>Description of controller_interface</description>
<maintainer email="bence.magyar.robotics@gmail.com">Bence Magyar</maintainer>
<maintainer email="denis@stoglrobotics.de">Denis Štogl</maintainer>
Expand Down
9 changes: 6 additions & 3 deletions controller_interface/src/controller_interface_base.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,15 +25,16 @@
namespace controller_interface
{
return_type ControllerInterfaceBase::init(
const std::string & controller_name, const std::string & namespace_,
const rclcpp::NodeOptions & node_options)
const std::string & controller_name, const std::string & urdf, unsigned int cm_update_rate,
const std::string & namespace_, const rclcpp::NodeOptions & node_options)
{
node_ = std::make_shared<rclcpp_lifecycle::LifecycleNode>(
controller_name, namespace_, node_options, false); // disable LifecycleNode service interfaces
urdf_ = urdf;

try
{
auto_declare<int>("update_rate", 0);
auto_declare<int>("update_rate", cm_update_rate);
auto_declare<bool>("is_async", false);
}
catch (const std::exception & e)
Expand Down Expand Up @@ -132,4 +133,6 @@ unsigned int ControllerInterfaceBase::get_update_rate() const { return update_ra

bool ControllerInterfaceBase::is_async() const { return is_async_; }

const std::string & ControllerInterfaceBase::get_robot_description() const { return urdf_; }

} // namespace controller_interface
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ TEST_F(ChainableControllerInterfaceTest, default_returns)
TestableChainableControllerInterface controller;

// initialize, create node
ASSERT_EQ(controller.init(TEST_CONTROLLER_NAME), controller_interface::return_type::OK);
ASSERT_EQ(controller.init(TEST_CONTROLLER_NAME, "", 50.0), controller_interface::return_type::OK);
ASSERT_NO_THROW(controller.get_node());

EXPECT_TRUE(controller.is_chainable());
Expand All @@ -33,7 +33,7 @@ TEST_F(ChainableControllerInterfaceTest, export_reference_interfaces)
TestableChainableControllerInterface controller;

// initialize, create node
ASSERT_EQ(controller.init(TEST_CONTROLLER_NAME), controller_interface::return_type::OK);
ASSERT_EQ(controller.init(TEST_CONTROLLER_NAME, "", 50.0), controller_interface::return_type::OK);
ASSERT_NO_THROW(controller.get_node());

auto reference_interfaces = controller.export_reference_interfaces();
Expand All @@ -50,7 +50,7 @@ TEST_F(ChainableControllerInterfaceTest, reference_interfaces_storage_not_correc
TestableChainableControllerInterface controller;

// initialize, create node
ASSERT_EQ(controller.init(TEST_CONTROLLER_NAME), controller_interface::return_type::OK);
ASSERT_EQ(controller.init(TEST_CONTROLLER_NAME, "", 50.0), controller_interface::return_type::OK);
ASSERT_NO_THROW(controller.get_node());

// expect empty return because storage is not resized
Expand All @@ -64,7 +64,7 @@ TEST_F(ChainableControllerInterfaceTest, reference_interfaces_prefix_is_not_node
TestableChainableControllerInterface controller;

// initialize, create node
ASSERT_EQ(controller.init(TEST_CONTROLLER_NAME), controller_interface::return_type::OK);
ASSERT_EQ(controller.init(TEST_CONTROLLER_NAME, "", 50.0), controller_interface::return_type::OK);
ASSERT_NO_THROW(controller.get_node());

controller.set_name_prefix_of_reference_interfaces("some_not_correct_interface_prefix");
Expand All @@ -79,7 +79,7 @@ TEST_F(ChainableControllerInterfaceTest, setting_chained_mode)
TestableChainableControllerInterface controller;

// initialize, create node
ASSERT_EQ(controller.init(TEST_CONTROLLER_NAME), controller_interface::return_type::OK);
ASSERT_EQ(controller.init(TEST_CONTROLLER_NAME, "", 50.0), controller_interface::return_type::OK);
ASSERT_NO_THROW(controller.get_node());

auto reference_interfaces = controller.export_reference_interfaces();
Expand Down Expand Up @@ -126,7 +126,7 @@ TEST_F(ChainableControllerInterfaceTest, test_update_logic)
TestableChainableControllerInterface controller;

// initialize, create node
ASSERT_EQ(controller.init(TEST_CONTROLLER_NAME), controller_interface::return_type::OK);
ASSERT_EQ(controller.init(TEST_CONTROLLER_NAME, "", 50.0), controller_interface::return_type::OK);
ASSERT_NO_THROW(controller.get_node());

EXPECT_FALSE(controller.is_in_chained_mode());
Expand Down
14 changes: 8 additions & 6 deletions controller_interface/test/test_controller_interface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,15 +38,15 @@ TEST(TestableControllerInterface, init)
ASSERT_THROW(controller.get_node(), std::runtime_error);

// initialize, create node
ASSERT_EQ(controller.init(TEST_CONTROLLER_NAME), controller_interface::return_type::OK);
ASSERT_EQ(controller.init(TEST_CONTROLLER_NAME, "", 10.0), controller_interface::return_type::OK);
ASSERT_NO_THROW(controller.get_node());

// update_rate is set to default 0
ASSERT_EQ(controller.get_update_rate(), 0u);

// Even after configure is 0
// Even after configure is 10
controller.configure();
ASSERT_EQ(controller.get_update_rate(), 0u);
ASSERT_EQ(controller.get_update_rate(), 10u);

rclcpp::shutdown();
}
Expand All @@ -60,7 +60,7 @@ TEST(TestableControllerInterface, setting_update_rate_in_configure)

TestableControllerInterface controller;
// initialize, create node
ASSERT_EQ(controller.init(TEST_CONTROLLER_NAME), controller_interface::return_type::OK);
ASSERT_EQ(controller.init(TEST_CONTROLLER_NAME, "", 1.0), controller_interface::return_type::OK);

// initialize executor to be able to get parameter update
auto executor =
Expand Down Expand Up @@ -122,7 +122,8 @@ TEST(TestableControllerInterfaceInitError, init_with_error)
TestableControllerInterfaceInitError controller;

// initialize, create node
ASSERT_EQ(controller.init(TEST_CONTROLLER_NAME), controller_interface::return_type::ERROR);
ASSERT_EQ(
controller.init(TEST_CONTROLLER_NAME, "", 100.0), controller_interface::return_type::ERROR);

rclcpp::shutdown();
}
Expand All @@ -136,7 +137,8 @@ TEST(TestableControllerInterfaceInitFailure, init_with_failure)
TestableControllerInterfaceInitFailure controller;

// initialize, create node
ASSERT_EQ(controller.init(TEST_CONTROLLER_NAME), controller_interface::return_type::ERROR);
ASSERT_EQ(
controller.init(TEST_CONTROLLER_NAME, "", 50.0), controller_interface::return_type::ERROR);

rclcpp::shutdown();
}
Expand Down
Loading

0 comments on commit 72b1ea7

Please sign in to comment.