Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add controller manager services #139

Merged
Merged
Show file tree
Hide file tree
Changes from 22 commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
5deeaf6
Add controller_manager_msgs package
Sep 2, 2020
f00ecec
Add switch and unload controller functionality
Sep 2, 2020
91e1767
Use ControllerSpec for storing controller type and name
Sep 2, 2020
bef08e2
Add more messages and services
Sep 9, 2020
27206ea
Add list_controllers service
Sep 9, 2020
47b170f
Implement load, unload, switch and reload services
Sep 14, 2020
81a8d21
Remove whitespaces
Sep 18, 2020
160a7c7
Reference issues for todos added during services PR
Sep 18, 2020
4c6a609
Refactor rt double buffered list for easier comprehension and safety
Sep 18, 2020
2b81d5d
Rename isControllerRunning function
Sep 18, 2020
e4e226c
Don't use raw pointers in switch controller and get_controller_by_name
Sep 18, 2020
64ff2b2
Apply suggestions from code review
v-lopez Sep 18, 2020
3481676
Apply suggestions from code review
v-lopez Sep 21, 2020
62df3aa
Documentation for controller_manager RT List wrapper and parameters
Sep 21, 2020
bc63827
controller_manager activate will not activate controllers
Sep 21, 2020
3650c38
Fix constness in controller_loader
Sep 21, 2020
9c05a5e
Apply suggestions from code review
v-lopez Sep 22, 2020
0967122
Fix remaining camelCase to snake_case
Sep 22, 2020
2805044
Update copyright year
Sep 22, 2020
ef1187f
Apply PR suggestions
Sep 22, 2020
0067623
Use find algorithms for finding controllers
Sep 22, 2020
b6ea360
Deduplicate code
Sep 22, 2020
2fba683
Remove get_controller_by_name and use names in stop/start request lists
Sep 25, 2020
dd02801
Apply suggestions from code review
v-lopez Sep 25, 2020
ae10741
Remove activate, deactivate, configure and cleanup
Sep 25, 2020
9aff325
Add namespace to controller_manager services
Sep 29, 2020
528d1c9
Allow undeclared parameters on controller_manager
Sep 29, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
17 changes: 16 additions & 1 deletion controller_manager/CMakeLists.txt
Expand Up @@ -14,6 +14,7 @@ find_package(ament_cmake)
find_package(ament_cmake_core REQUIRED)
find_package(ament_index_cpp REQUIRED)
find_package(controller_interface REQUIRED)
find_package(controller_manager_msgs REQUIRED)
find_package(hardware_interface REQUIRED)
find_package(pluginlib REQUIRED)
find_package(rclcpp REQUIRED)
Expand All @@ -23,6 +24,7 @@ target_include_directories(controller_manager PRIVATE include)
ament_target_dependencies(controller_manager
ament_index_cpp
controller_interface
controller_manager_msgs
hardware_interface
pluginlib
rclcpp
Expand Down Expand Up @@ -62,7 +64,7 @@ if(BUILD_TESTING)
target_link_libraries(test_controller controller_manager)
target_compile_definitions(test_controller PRIVATE "CONTROLLER_MANAGER_BUILDING_DLL")

ament_add_gtest(
ament_add_gmock(
test_controller_manager
test/test_controller_manager.cpp
)
Expand All @@ -85,6 +87,18 @@ if(BUILD_TESTING)
test_robot_hardware
)

ament_add_gmock(
test_controller_manager_srvs
test/test_controller_manager_srvs.cpp
APPEND_ENV AMENT_PREFIX_PATH=${ament_index_build_path}_$<CONFIG>
)
target_include_directories(test_controller_manager_srvs PRIVATE include)
target_link_libraries(test_controller_manager_srvs controller_manager test_controller)
ament_target_dependencies(
test_controller_manager_srvs
test_robot_hardware
)

pluginlib_export_plugin_description_file(controller_interface test/test_controller.xml)

install(TARGETS test_controller
Expand All @@ -100,6 +114,7 @@ ament_export_include_directories(
)
ament_export_dependencies(
controller_interface
controller_manager_msgs
pluginlib
)
ament_package()
Expand Up @@ -17,6 +17,7 @@

#include <memory>
#include <string>
#include <vector>

#include "controller_interface/controller_interface.hpp"

Expand All @@ -29,7 +30,8 @@ class ControllerLoaderInterface
{
public:
CONTROLLER_MANAGER_PUBLIC
ControllerLoaderInterface() = default;
explicit ControllerLoaderInterface(const std::string & name)
: name_(name) {}

CONTROLLER_MANAGER_PUBLIC
virtual ~ControllerLoaderInterface() = default;
Expand All @@ -40,6 +42,18 @@ class ControllerLoaderInterface

CONTROLLER_MANAGER_PUBLIC
virtual bool is_available(const std::string & controller_type) const = 0;

CONTROLLER_MANAGER_PUBLIC
const std::string & get_name() const {return name_;}

CONTROLLER_MANAGER_PUBLIC
virtual std::vector<std::string> get_declared_classes() const = 0;

CONTROLLER_MANAGER_PUBLIC
virtual void reload() = 0;

private:
const std::string name_;
};

using ControllerLoaderInterfaceSharedPtr = std::shared_ptr<ControllerLoaderInterface>;
Expand Down
Expand Up @@ -19,6 +19,7 @@

#include <memory>
#include <string>
#include <vector>

#include "pluginlib/class_loader.hpp"

Expand All @@ -40,6 +41,12 @@ class ControllerLoaderPluginlib : public ControllerLoaderInterface
CONTROLLER_MANAGER_PUBLIC
bool is_available(const std::string & controller_type) const;

CONTROLLER_MANAGER_PUBLIC
std::vector<std::string> get_declared_classes() const override;

CONTROLLER_MANAGER_PUBLIC
void reload() override;

private:
std::shared_ptr<pluginlib::ClassLoader<controller_interface::ControllerInterface>> loader_;
};
Expand Down