EasyFleet
A simple-by-default framework for multi-robot, multi-capability fleets built on ROS 2
Loading...
Searching...
No Matches
capability_factory.hpp
1// Copyright 2026 Intelligent Robotics Lab
2//
3// This file is part of the project EasyFleet
4// Licensed under the Apache License, Version 2.0 (the "License");
5// you may not use this file except in compliance with the License.
6// You may obtain a copy of the License at
7//
8// http://www.apache.org/licenses/LICENSE-2.0
9//
10// Unless required by applicable law or agreed to in writing, software
11// distributed under the License is distributed on an "AS IS" BASIS,
12// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13// See the License for the specific language governing permissions and
14// limitations under the License.
15
16#ifndef EASYFLEET_CORE__CAPABILITY_FACTORY_HPP_
17#define EASYFLEET_CORE__CAPABILITY_FACTORY_HPP_
18
19#include <memory>
20#include <string>
21
22#include "rclcpp/node_options.hpp"
23
24#include "easyfleet_core/capability.hpp"
25#include "easyfleet_core/capability_node_base.hpp"
26
27namespace easyfleet_core
28{
29
40{
41public:
43 using SharedPtr = std::shared_ptr<CapabilityFactory>;
44
45 virtual ~CapabilityFactory() = default;
46
57 virtual std::shared_ptr<CapabilityNodeBase> create(
58 const std::string & capability_name,
59 const rclcpp::NodeOptions & options) const = 0;
60};
61
71template<typename ActionServerT>
73{
74public:
75 std::shared_ptr<CapabilityNodeBase> create(
76 const std::string & capability_name,
77 const rclcpp::NodeOptions & options) const override
78 {
79 return std::make_shared<Capability<ActionServerT>>(capability_name, options);
80 }
81};
82
83} // namespace easyfleet_core
84
85#endif // EASYFLEET_CORE__CAPABILITY_FACTORY_HPP_
Boilerplate-free CapabilityFactory for any Capability<ActionServerT>.
Definition capability_factory.hpp:73
std::shared_ptr< CapabilityNodeBase > create(const std::string &capability_name, const rclcpp::NodeOptions &options) const override
Constructs and returns one capability node instance ready for the caller to configure()/activate().
Definition capability_factory.hpp:75
Pluginlib base class for "a thing that can build a capability node byname".
Definition capability_factory.hpp:40
virtual std::shared_ptr< CapabilityNodeBase > create(const std::string &capability_name, const rclcpp::NodeOptions &options) const =0
Constructs and returns one capability node instance ready for the caller to configure()/activate().
std::shared_ptr< CapabilityFactory > SharedPtr
Shared pointer to a CapabilityFactory.
Definition capability_factory.hpp:43