EasyFleet
A simple-by-default framework for multi-robot, multi-capability fleets built on ROS 2
Loading...
Searching...
No Matches
capability_node_base.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_NODE_BASE_HPP_
17#define EASYFLEET_CORE__CAPABILITY_NODE_BASE_HPP_
18
19#include <memory>
20#include <string>
21
22#include "rclcpp/node_interfaces/node_base_interface.hpp"
23#include "rclcpp_lifecycle/node_interfaces/lifecycle_node_interface.hpp"
24
25namespace easyfleet_core
26{
27
41{
42public:
44 using SharedPtr = std::shared_ptr<CapabilityNodeBase>;
46 using CallbackReturn = rclcpp_lifecycle::node_interfaces::LifecycleNodeInterface::CallbackReturn;
47
48 virtual ~CapabilityNodeBase() = default;
49
50 // Named *_node() rather than plain configure()/activate()/etc.: those
51 // names are already taken, with different signatures, by
52 // rclcpp_lifecycle::LifecycleNode itself (which Capability<ActionServerT>
53 // also derives from). Reusing them here would silently *hide* (not
54 // override) LifecycleNode's own overloads for any code holding a
55 // Capability<T>* directly -- including the one-arg configure(CallbackReturn&)
56 // overload existing code (test_capability.cpp) already calls -- breaking
57 // it. Distinct names sidestep that entirely.
77 virtual uint8_t get_current_state_id() const = 0;
78
82 virtual rclcpp::node_interfaces::NodeBaseInterface::SharedPtr get_node_base_interface() = 0;
83
87 virtual const std::string & get_capability_name() const = 0;
91 virtual const std::string & get_robot_name() const = 0;
92};
93
94} // namespace easyfleet_core
95
96#endif // EASYFLEET_CORE__CAPABILITY_NODE_BASE_HPP_
Non-template handle to an already-constructed Capability<ActionServerT> instance, exposing exactly th...
Definition capability_node_base.hpp:41
virtual rclcpp::node_interfaces::NodeBaseInterface::SharedPtr get_node_base_interface()=0
So a Deployment can add the underlying node to its shared executor without knowing its concrete type.
virtual CallbackReturn configure_node()=0
Drive the underlying lifecycle node from UNCONFIGURED to INACTIVE.
virtual const std::string & get_robot_name() const =0
The robot identity field published on /capabilities and /capabilities_status.
virtual CallbackReturn shutdown_node()=0
Drive the underlying lifecycle node to FINALIZED, from whatever state it is currently in.
virtual CallbackReturn cleanup_node()=0
Drive the underlying lifecycle node from INACTIVE to UNCONFIGURED.
virtual CallbackReturn activate_node()=0
Drive the underlying lifecycle node from INACTIVE to ACTIVE.
virtual CallbackReturn deactivate_node()=0
Drive the underlying lifecycle node from ACTIVE to INACTIVE.
rclcpp_lifecycle::node_interfaces::LifecycleNodeInterface::CallbackReturn CallbackReturn
Lifecycle transition result type shared with rclcpp_lifecycle.
Definition capability_node_base.hpp:46
std::shared_ptr< CapabilityNodeBase > SharedPtr
Shared pointer to a CapabilityNodeBase.
Definition capability_node_base.hpp:44
virtual const std::string & get_capability_name() const =0
The capability identity field published on /capabilities and /capabilities_status.
virtual uint8_t get_current_state_id() const =0
The underlying lifecycle node's current state id.