Skip to content

Commit

Permalink
Add ControllerInterfaceBase class and use it in Controller Manager.
Browse files Browse the repository at this point in the history
  • Loading branch information
destogl committed May 16, 2022
1 parent ed0d8d6 commit 648d039
Show file tree
Hide file tree
Showing 11 changed files with 16 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ class ControllerInterface : public controller_interface::ControllerInterfaceBase
/**
* Controller is not chainable, therefore no chained mode can be set.
*
* \returns false;
* \returns false.
*/
CONTROLLER_INTERFACE_PUBLIC
bool set_chained_mode(bool chained_mode) final;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -186,4 +186,4 @@ void TestChainableController::set_reference_interface_names(
#include "pluginlib/class_list_macros.hpp"

PLUGINLIB_EXPORT_CLASS(
test_chainable_controller::TestChainableController, controller_interface::ControllerInterface)
test_chainable_controller::TestChainableController, controller_interface::ControllerInterfaceBase)
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<class name="controller_manager/test_chainable_controller"
type="test_chainable_controller::TestChainableController"
base_class_type="controller_interface::ControllerInterface">
base_class_type="controller_interface::ControllerInterfaceBase">
<description>
Controller used for testing
</description>
Expand Down
3 changes: 2 additions & 1 deletion controller_manager/test/test_controller/test_controller.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -111,4 +111,5 @@ void TestController::set_state_interface_configuration(

#include "pluginlib/class_list_macros.hpp"

PLUGINLIB_EXPORT_CLASS(test_controller::TestController, controller_interface::ControllerInterface)
PLUGINLIB_EXPORT_CLASS(
test_controller::TestController, controller_interface::ControllerInterfaceBase)
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<library path="test_controller">

<class name="controller_manager/test_controller" type="test_controller::TestController" base_class_type="controller_interface::ControllerInterface">
<class name="controller_manager/test_controller" type="test_controller::TestController" base_class_type="controller_interface::ControllerInterfaceBase">
<description>
Controller used for testing
</description>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,4 +49,5 @@ controller_interface::return_type TestControllerFailedInit::update(
#include "pluginlib/class_list_macros.hpp"

PLUGINLIB_EXPORT_CLASS(
test_controller_failed_init::TestControllerFailedInit, controller_interface::ControllerInterface)
test_controller_failed_init::TestControllerFailedInit,
controller_interface::ControllerInterfaceBase)
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<library path="test_controller_failed_init">

<class name="controller_manager/test_controller_failed_init" type="test_controller_failed_init::TestControllerFailedInit" base_class_type="controller_interface::ControllerInterface">
<class name="controller_manager/test_controller_failed_init" type="test_controller_failed_init::TestControllerFailedInit" base_class_type="controller_interface::ControllerInterfaceBase">
<description>
Controller used for testing
</description>
Expand Down
2 changes: 1 addition & 1 deletion controller_manager/test/test_controller_manager_srvs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ TEST_F(TestControllerManagerSrvs, list_controller_types)
ASSERT_EQ(controller_types, result->base_classes.size());
ASSERT_THAT(result->types, ::testing::Contains(test_controller::TEST_CONTROLLER_CLASS_NAME));
ASSERT_THAT(
result->base_classes, ::testing::Contains("controller_interface::ControllerInterface"));
result->base_classes, ::testing::Contains("controller_interface::ControllerInterfaceBase"));
}

TEST_F(TestControllerManagerSrvs, list_controllers_srv)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,4 +56,4 @@ TestControllerWithInterfaces::on_cleanup(const rclcpp_lifecycle::State & /*previ

PLUGINLIB_EXPORT_CLASS(
test_controller_with_interfaces::TestControllerWithInterfaces,
controller_interface::ControllerInterface)
controller_interface::ControllerInterfaceBase)
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<library path="test_controller_with_interfaces">

<class name="controller_manager/test_controller_with_interfaces" type="test_controller_with_interfaces::TestControllerWithInterfaces" base_class_type="controller_interface::ControllerInterface">
<class name="controller_manager/test_controller_with_interfaces" type="test_controller_with_interfaces::TestControllerWithInterfaces" base_class_type="controller_interface::ControllerInterfaceBase">
<description>
Controller used for testing
</description>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@ class TestControllerChainingWithControllerManager

template <
typename T, typename std::enable_if<
std::is_convertible<T *, controller_interface::ControllerInterface *>::value,
std::is_convertible<T *, controller_interface::ControllerInterfaceBase *>::value,
T>::type * = nullptr>
void SetToChainedModeAndMakeReferenceInterfacesAvailable(
std::shared_ptr<T> & controller, const std::string & controller_name,
Expand All @@ -236,7 +236,7 @@ class TestControllerChainingWithControllerManager

template <
typename T, typename std::enable_if<
std::is_convertible<T *, controller_interface::ControllerInterface *>::value,
std::is_convertible<T *, controller_interface::ControllerInterfaceBase *>::value,
T>::type * = nullptr>
void check_after_de_activate(
std::shared_ptr<T> & controller, const std::vector<std::string> & claimed_command_itfs,
Expand Down Expand Up @@ -273,7 +273,7 @@ class TestControllerChainingWithControllerManager

template <
typename T, typename std::enable_if<
std::is_convertible<T *, controller_interface::ControllerInterface *>::value,
std::is_convertible<T *, controller_interface::ControllerInterfaceBase *>::value,
T>::type * = nullptr>
void ActivateAndCheckController(
std::shared_ptr<T> & controller, const std::string & controller_name,
Expand All @@ -288,7 +288,7 @@ class TestControllerChainingWithControllerManager

template <
typename T, typename std::enable_if<
std::is_convertible<T *, controller_interface::ControllerInterface *>::value,
std::is_convertible<T *, controller_interface::ControllerInterfaceBase *>::value,
T>::type * = nullptr>
void DeactivateAndCheckController(
std::shared_ptr<T> & controller, const std::string & controller_name,
Expand Down

0 comments on commit 648d039

Please sign in to comment.