Skip to content

Commit

Permalink
Merge branch 'master' into remove-enum
Browse files Browse the repository at this point in the history
  • Loading branch information
saikishor authored Dec 20, 2024
2 parents ae56c98 + 8b99e0b commit 1fa79db
Show file tree
Hide file tree
Showing 30 changed files with 156 additions and 21 deletions.
6 changes: 6 additions & 0 deletions controller_interface/CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@
Changelog for package controller_interface
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

4.22.0 (2024-12-20)
-------------------
* Fixed typo. Added s to state_interfaces\_ (`#1930 <https://github.com/ros-controls/ros2_control/issues/1930>`_)
* [CI] Add clang job, setup concurrency, use rt_tools humble branch (`#1910 <https://github.com/ros-controls/ros2_control/issues/1910>`_)
* Contributors: Christoph Fröhlich, louietouie

4.21.0 (2024-12-06)
-------------------
* [Diagnostics] Add diagnostics of execution time and periodicity of the controllers and controller_manager (`#1871 <https://github.com/ros-controls/ros2_control/issues/1871>`_)
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>4.21.0</version>
<version>4.22.0</version>
<description>Description of controller_interface</description>
<maintainer email="[email protected]">Bence Magyar</maintainer>
<maintainer email="[email protected]">Denis Štogl</maintainer>
Expand Down
13 changes: 13 additions & 0 deletions controller_manager/CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,19 @@
Changelog for package controller_manager
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

4.22.0 (2024-12-20)
-------------------
* Async Hardware Components (`#1567 <https://github.com/ros-controls/ros2_control/issues/1567>`_)
* Add controller node options args to be able to set controller specific node arguments (`#1713 <https://github.com/ros-controls/ros2_control/issues/1713>`_)
* Use singleton approach to store and reuse the service clients (`#1949 <https://github.com/ros-controls/ros2_control/issues/1949>`_)
* Increase the max and min periodicity tolerances to fix flaky tests (`#1937 <https://github.com/ros-controls/ros2_control/issues/1937>`_)
* Fix the spawner to support full wildcard parameter entries (`#1933 <https://github.com/ros-controls/ros2_control/issues/1933>`_)
* Suppress unnecessary warnings in clock received validation (`#1935 <https://github.com/ros-controls/ros2_control/issues/1935>`_)
* Optimize the valid time check in the update loop (`#1923 <https://github.com/ros-controls/ros2_control/issues/1923>`_)
* [CI] Add clang job, setup concurrency, use rt_tools humble branch (`#1910 <https://github.com/ros-controls/ros2_control/issues/1910>`_)
* Update CPU affinity parameter to be able to set multiple CPUs (`#1915 <https://github.com/ros-controls/ros2_control/issues/1915>`_)
* Contributors: Christoph Fröhlich, Sai Kishor Kothakota, Takashi Sato

4.21.0 (2024-12-06)
-------------------
* Use the .hpp headers from realtime_tools package (`#1916 <https://github.com/ros-controls/ros2_control/issues/1916>`_)
Expand Down
2 changes: 1 addition & 1 deletion controller_manager/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_manager</name>
<version>4.21.0</version>
<version>4.22.0</version>
<description>Description of controller_manager</description>
<maintainer email="[email protected]">Bence Magyar</maintainer>
<maintainer email="[email protected]">Denis Štogl</maintainer>
Expand Down
3 changes: 3 additions & 0 deletions controller_manager_msgs/CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@
Changelog for package controller_manager_msgs
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

4.22.0 (2024-12-20)
-------------------

4.21.0 (2024-12-06)
-------------------

Expand Down
2 changes: 1 addition & 1 deletion controller_manager_msgs/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_format3.xsd" schematypens="http://www.w3.org/2001/XMLSchema"?>
<package format="3">
<name>controller_manager_msgs</name>
<version>4.21.0</version>
<version>4.22.0</version>
<description>Messages and services for the controller manager.</description>
<maintainer email="[email protected]">Bence Magyar</maintainer>
<maintainer email="[email protected]">Denis Štogl</maintainer>
Expand Down
10 changes: 10 additions & 0 deletions hardware_interface/CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,16 @@
Changelog for package hardware_interface
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

4.22.0 (2024-12-20)
-------------------
* Propagate read/write rate to the HardwareInfo properly (`#1928 <https://github.com/ros-controls/ros2_control/issues/1928>`_)
* Async Hardware Components (`#1567 <https://github.com/ros-controls/ros2_control/issues/1567>`_)
* Add controller node options args to be able to set controller specific node arguments (`#1713 <https://github.com/ros-controls/ros2_control/issues/1713>`_)
* Make get_name() return a const reference (`#1952 <https://github.com/ros-controls/ros2_control/issues/1952>`_)
* Let sensors also export state interfaces of joints (`#1885 <https://github.com/ros-controls/ros2_control/issues/1885>`_)
* [CI] Add clang job, setup concurrency, use rt_tools humble branch (`#1910 <https://github.com/ros-controls/ros2_control/issues/1910>`_)
* Contributors: Christoph Fröhlich, Sai Kishor Kothakota, Takashi Sato

4.21.0 (2024-12-06)
-------------------
* [Feature] Choose different read and write rate for the hardware components (`#1570 <https://github.com/ros-controls/ros2_control/issues/1570>`_)
Expand Down
2 changes: 1 addition & 1 deletion hardware_interface/package.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0"?>
<package format="2">
<name>hardware_interface</name>
<version>4.21.0</version>
<version>4.22.0</version>
<description>ros2_control hardware interface</description>
<maintainer email="[email protected]">Bence Magyar</maintainer>
<maintainer email="[email protected]">Denis Štogl</maintainer>
Expand Down
13 changes: 8 additions & 5 deletions hardware_interface/src/resource_manager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -141,10 +141,7 @@ class ResourceStorage
component_info.name = hardware_info.name;
component_info.type = hardware_info.type;
component_info.group = hardware_info.group;
component_info.rw_rate =
(hardware_info.rw_rate == 0 || hardware_info.rw_rate > cm_update_rate_)
? cm_update_rate_
: hardware_info.rw_rate;
component_info.rw_rate = hardware_info.rw_rate;
component_info.plugin_name = hardware_info.hardware_plugin_name;
component_info.is_async = hardware_info.is_async;

Expand Down Expand Up @@ -1051,7 +1048,13 @@ bool ResourceManager::load_and_initialize_components(

resource_storage_->cm_update_rate_ = update_rate;

const auto hardware_info = hardware_interface::parse_control_resources_from_urdf(urdf);
auto hardware_info = hardware_interface::parse_control_resources_from_urdf(urdf);
// Set the update rate for all hardware components
for (auto & hw : hardware_info)
{
hw.rw_rate =
(hw.rw_rate == 0 || hw.rw_rate > update_rate) ? update_rate : hw.rw_rate;
}

const std::string system_type = "system";
const std::string sensor_type = "sensor";
Expand Down
14 changes: 11 additions & 3 deletions hardware_interface/test/mock_components/test_generic_system.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -699,9 +699,11 @@ class TestableResourceManager : public hardware_interface::ResourceManager
}

explicit TestableResourceManager(
rclcpp::Node & node, const std::string & urdf, bool activate_all = false)
rclcpp::Node & node, const std::string & urdf, bool activate_all = false,
unsigned int cm_update_rate = 100)
: hardware_interface::ResourceManager(
urdf, node.get_node_clock_interface(), node.get_node_logging_interface(), activate_all, 100)
urdf, node.get_node_clock_interface(), node.get_node_logging_interface(), activate_all,
cm_update_rate)
{
}
};
Expand Down Expand Up @@ -842,14 +844,17 @@ void generic_system_functional_test(
EXPECT_EQ(
status_map[component_name].state.label(),
hardware_interface::lifecycle_state_names::UNCONFIGURED);
EXPECT_EQ(status_map[component_name].rw_rate, 100u);
configure_components(rm, {component_name});
status_map = rm.get_components_status();
EXPECT_EQ(
status_map[component_name].state.label(), hardware_interface::lifecycle_state_names::INACTIVE);
EXPECT_EQ(status_map[component_name].rw_rate, 100u);
activate_components(rm, {component_name});
status_map = rm.get_components_status();
EXPECT_EQ(
status_map[component_name].state.label(), hardware_interface::lifecycle_state_names::ACTIVE);
EXPECT_EQ(status_map[component_name].rw_rate, 100u);

// Check initial values
hardware_interface::LoanedStateInterface j1p_s = rm.claim_state_interface("joint1/position");
Expand Down Expand Up @@ -935,7 +940,7 @@ void generic_system_error_group_test(
const std::string & urdf, const std::string component_prefix, bool validate_same_group)
{
rclcpp::Node node("test_generic_system");
TestableResourceManager rm(node, urdf);
TestableResourceManager rm(node, urdf, false, 200u);
const std::string component1 = component_prefix + "1";
const std::string component2 = component_prefix + "2";
// check is hardware is configured
Expand All @@ -944,14 +949,17 @@ void generic_system_error_group_test(
{
EXPECT_EQ(
status_map[component].state.label(), hardware_interface::lifecycle_state_names::UNCONFIGURED);
EXPECT_EQ(status_map[component].rw_rate, 200u);
configure_components(rm, {component});
status_map = rm.get_components_status();
EXPECT_EQ(
status_map[component].state.label(), hardware_interface::lifecycle_state_names::INACTIVE);
EXPECT_EQ(status_map[component].rw_rate, 200u);
activate_components(rm, {component});
status_map = rm.get_components_status();
EXPECT_EQ(
status_map[component].state.label(), hardware_interface::lifecycle_state_names::ACTIVE);
EXPECT_EQ(status_map[component].rw_rate, 200u);
}

// Check initial values
Expand Down
38 changes: 38 additions & 0 deletions hardware_interface/test/test_component_parser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1418,6 +1418,8 @@ TEST_F(TestComponentParser, successfully_parse_parameter_empty)

EXPECT_EQ(hardware_info.hardware_parameters.at("example_param_write_for_sec"), "");
EXPECT_EQ(hardware_info.hardware_parameters.at("example_param_read_for_sec"), "2");
// when not set, rw_rate should be 0
EXPECT_EQ(hardware_info.rw_rate, 0u);

// Verify limits parsed from the URDF
ASSERT_THAT(hardware_info.limits, SizeIs(1));
Expand Down Expand Up @@ -1492,6 +1494,8 @@ TEST_F(TestComponentParser, gripper_mimic_true_valid_config)
EXPECT_DOUBLE_EQ(hw_info[0].mimic_joints[0].offset, 1.0);
EXPECT_EQ(hw_info[0].mimic_joints[0].mimicked_joint_index, 0);
EXPECT_EQ(hw_info[0].mimic_joints[0].joint_index, 1);
// when not set, rw_rate should be 0
EXPECT_EQ(hw_info[0].rw_rate, 0u);
}

TEST_F(TestComponentParser, gripper_no_mimic_valid_config)
Expand All @@ -1508,6 +1512,8 @@ TEST_F(TestComponentParser, gripper_no_mimic_valid_config)
EXPECT_DOUBLE_EQ(hw_info[0].mimic_joints[0].offset, 1.0);
EXPECT_EQ(hw_info[0].mimic_joints[0].mimicked_joint_index, 0);
EXPECT_EQ(hw_info[0].mimic_joints[0].joint_index, 1);
// when not set, rw_rate should be 0
EXPECT_EQ(hw_info[0].rw_rate, 0u);
}

TEST_F(TestComponentParser, negative_rw_rates_throws_error)
Expand Down Expand Up @@ -1540,6 +1546,38 @@ TEST_F(TestComponentParser, invalid_rw_rates_out_of_range)
ASSERT_THROW(parse_control_resources_from_urdf(urdf_to_test), std::runtime_error);
}

TEST_F(TestComponentParser, valid_rw_rate)
{
std::vector<hardware_interface::HardwareInfo> hw_info;
ASSERT_NO_THROW(
hw_info = parse_control_resources_from_urdf(
ros2_control_test_assets::minimal_robot_urdf_with_different_hw_rw_rate));
ASSERT_THAT(hw_info, SizeIs(3));
EXPECT_EQ(hw_info[0].name, "TestActuatorHardware");
EXPECT_EQ(hw_info[0].type, "actuator");
EXPECT_EQ(hw_info[0].hardware_plugin_name, "test_actuator");
ASSERT_THAT(hw_info[0].joints, SizeIs(1));
EXPECT_EQ(hw_info[0].joints[0].name, "joint1");
EXPECT_EQ(hw_info[0].rw_rate, 50u);

EXPECT_EQ(hw_info[1].name, "TestSensorHardware");
EXPECT_EQ(hw_info[1].type, "sensor");
EXPECT_EQ(hw_info[1].hardware_plugin_name, "test_sensor");
ASSERT_THAT(hw_info[1].sensors, SizeIs(1));
EXPECT_EQ(hw_info[1].sensors[0].name, "sensor1");
EXPECT_EQ(hw_info[1].rw_rate, 20u);

EXPECT_EQ(hw_info[2].name, "TestSystemHardware");
EXPECT_EQ(hw_info[2].type, "system");
EXPECT_EQ(hw_info[2].hardware_plugin_name, "test_system");
ASSERT_THAT(hw_info[2].joints, SizeIs(2));
EXPECT_EQ(hw_info[2].joints[0].name, "joint2");
EXPECT_EQ(hw_info[2].joints[1].name, "joint3");
ASSERT_THAT(hw_info[2].gpios, SizeIs(1));
EXPECT_EQ(hw_info[2].gpios[0].name, "configuration");
EXPECT_EQ(hw_info[2].rw_rate, 25u);
}

TEST_F(TestComponentParser, gripper_mimic_with_unknown_joint_throws_error)
{
const auto urdf_to_test =
Expand Down
6 changes: 6 additions & 0 deletions hardware_interface_testing/CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@
Changelog for package hardware_interface_testing
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

4.22.0 (2024-12-20)
-------------------
* Propagate read/write rate to the HardwareInfo properly (`#1928 <https://github.com/ros-controls/ros2_control/issues/1928>`_)
* Async Hardware Components (`#1567 <https://github.com/ros-controls/ros2_control/issues/1567>`_)
* Contributors: Sai Kishor Kothakota

4.21.0 (2024-12-06)
-------------------
* [Feature] Choose different read and write rate for the hardware components (`#1570 <https://github.com/ros-controls/ros2_control/issues/1570>`_)
Expand Down
2 changes: 1 addition & 1 deletion hardware_interface_testing/package.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0"?>
<package format="2">
<name>hardware_interface_testing</name>
<version>4.21.0</version>
<version>4.22.0</version>
<description>ros2_control hardware interface testing</description>
<maintainer email="[email protected]">Bence Magyar</maintainer>
<maintainer email="[email protected]">Denis Štogl</maintainer>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
#include <vector>

#include "hardware_interface/actuator_interface.hpp"
#include "rclcpp/logging.hpp"
#include "ros2_control_test_assets/test_hardware_interface_constants.hpp"

using hardware_interface::ActuatorInterface;
Expand All @@ -35,6 +36,14 @@ class TestActuator : public ActuatorInterface
{
return CallbackReturn::ERROR;
}
if (get_hardware_info().rw_rate == 0u)
{
RCLCPP_WARN(
get_logger(),
"Actuator hardware component '%s' from plugin '%s' failed to initialize as rw_rate is 0.",
get_hardware_info().name.c_str(), get_hardware_info().hardware_plugin_name.c_str());
return CallbackReturn::ERROR;
}

/*
* a hardware can optional prove for incorrect info here.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
#include <vector>

#include "hardware_interface/sensor_interface.hpp"
#include "rclcpp/logging.hpp"

using hardware_interface::return_type;
using hardware_interface::SensorInterface;
Expand All @@ -33,6 +34,14 @@ class TestSensor : public SensorInterface
{
return CallbackReturn::ERROR;
}
if (get_hardware_info().rw_rate == 0u)
{
RCLCPP_WARN(
get_logger(),
"Sensor hardware component '%s' from plugin '%s' failed to initialize as rw_rate is 0.",
get_hardware_info().name.c_str(), get_hardware_info().hardware_plugin_name.c_str());
return CallbackReturn::ERROR;
}
return CallbackReturn::SUCCESS;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@

#include "hardware_interface/system_interface.hpp"
#include "hardware_interface/types/hardware_interface_type_values.hpp"
#include "rclcpp/logging.hpp"
#include "ros2_control_test_assets/test_hardware_interface_constants.hpp"

using hardware_interface::CommandInterface;
Expand All @@ -39,6 +40,14 @@ class TestSystem : public SystemInterface
return CallbackReturn::ERROR;
}

if (get_hardware_info().rw_rate == 0u)
{
RCLCPP_WARN(
get_logger(),
"System hardware component '%s' from plugin '%s' failed to initialize as rw_rate is 0.",
get_hardware_info().name.c_str(), get_hardware_info().hardware_plugin_name.c_str());
return CallbackReturn::ERROR;
}
return CallbackReturn::SUCCESS;
}

Expand Down
3 changes: 3 additions & 0 deletions joint_limits/CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@
Changelog for package joint_limits
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

4.22.0 (2024-12-20)
-------------------

4.21.0 (2024-12-06)
-------------------
* Use the .hpp headers from realtime_tools package (`#1916 <https://github.com/ros-controls/ros2_control/issues/1916>`_)
Expand Down
2 changes: 1 addition & 1 deletion joint_limits/package.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<package format="3">
<name>joint_limits</name>
<version>4.21.0</version>
<version>4.22.0</version>
<description>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.</description>

<maintainer email="[email protected]">Bence Magyar</maintainer>
Expand Down
3 changes: 3 additions & 0 deletions ros2_control/CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@
Changelog for package ros2_control
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

4.22.0 (2024-12-20)
-------------------

4.21.0 (2024-12-06)
-------------------

Expand Down
2 changes: 1 addition & 1 deletion ros2_control/package.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0"?>
<package format="3">
<name>ros2_control</name>
<version>4.21.0</version>
<version>4.22.0</version>
<description>Metapackage for ROS2 control related packages</description>
<maintainer email="[email protected]">Bence Magyar</maintainer>
<maintainer email="[email protected]">Denis Štogl</maintainer>
Expand Down
6 changes: 6 additions & 0 deletions ros2_control_test_assets/CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@
Changelog for package ros2_control_test_assets
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

4.22.0 (2024-12-20)
-------------------
* Async Hardware Components (`#1567 <https://github.com/ros-controls/ros2_control/issues/1567>`_)
* Let sensors also export state interfaces of joints (`#1885 <https://github.com/ros-controls/ros2_control/issues/1885>`_)
* Contributors: Christoph Fröhlich, Sai Kishor Kothakota

4.21.0 (2024-12-06)
-------------------
* [Feature] Choose different read and write rate for the hardware components (`#1570 <https://github.com/ros-controls/ros2_control/issues/1570>`_)
Expand Down
2 changes: 1 addition & 1 deletion ros2_control_test_assets/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_format3.xsd" schematypens="http://www.w3.org/2001/XMLSchema"?>
<package format="3">
<name>ros2_control_test_assets</name>
<version>4.21.0</version>
<version>4.22.0</version>
<description>The package provides shared test resources for ros2_control stack
</description>
<maintainer email="[email protected]">Bence Magyar</maintainer>
Expand Down
Loading

0 comments on commit 1fa79db

Please sign in to comment.