EasyFleet
A simple-by-default framework for multi-robot, multi-capability fleets built on ROS 2
Loading...
Searching...
No Matches
deployment.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__DEPLOYMENT_HPP_
17#define EASYFLEET_CORE__DEPLOYMENT_HPP_
18
19#include <memory>
20#include <string>
21#include <vector>
22
23#include "pluginlib/class_loader.hpp"
24#include "rclcpp/executors/single_threaded_executor.hpp"
25#include "rclcpp/node.hpp"
26#include "rclcpp/node_options.hpp"
27
28#include "easyfleet_core/capability_factory.hpp"
29#include "easyfleet_core/capability_node_base.hpp"
30
31namespace easyfleet
32{
33
36
84{
85public:
91 Deployment();
92
99 explicit Deployment(std::string name);
100
104 const std::string & name() const noexcept;
105
108
128 void add_capability(
129 const std::string & plugin_lookup_name,
130 const rclcpp::NodeOptions & options = rclcpp::NodeOptions());
131
134 const std::vector<easyfleet_core::CapabilityNodeBase::SharedPtr> & capabilities() const noexcept;
135
144
153 void add_capabilities_from_parameters(const std::string & package_name);
154
157
165 void start();
166
172 void run();
173
177 void shutdown();
178
179private:
180 std::string name_;
181 std::vector<easyfleet_core::CapabilityNodeBase::SharedPtr> capabilities_;
182
189 std::unique_ptr<pluginlib::ClassLoader<easyfleet_core::CapabilityFactory>> loader_;
190
191 rclcpp::executors::SingleThreadedExecutor executor_;
192
200 rclcpp::Node::SharedPtr config_node();
201 rclcpp::Node::SharedPtr config_node_;
202};
203
204} // namespace easyfleet
205
206#endif // EASYFLEET_CORE__DEPLOYMENT_HPP_
void run()
Adds every capability's node to one shared executor and blocks until SIGINT/SIGTERM (see spin_until_s...
Definition deployment.cpp:147
const std::string & name() const noexcept
This robot's identity, as passed to the constructor.
Definition deployment.cpp:59
void add_capability(const std::string &plugin_lookup_name, const rclcpp::NodeOptions &options=rclcpp::NodeOptions())
Loads, constructs and starts hosting one capability.
Definition deployment.cpp:64
const std::vector< easyfleet_core::CapabilityNodeBase::SharedPtr > & capabilities() const noexcept
Every capability added so far, in add_capability() order.
Definition deployment.cpp:82
void start()
Configures, then activates, every added capability, in the order they were added.
Definition deployment.cpp:125
void shutdown()
Shuts down every capability's lifecycle node, then calls rclcpp::shutdown() – the ROS context teardow...
Definition deployment.cpp:175
void add_capabilities_from_parameters(const std::string &package_name)
Reads which capabilities to host from this process's own "capabilities" (string list) and "config_sub...
Definition deployment.cpp:95
Deployment()
Robot identity inferred from this process's own ROS namespace (e.g.
Definition deployment.cpp:49