CORESENSE4home_Architecture
Loading...
Searching...
No Matches
Master.hpp
Go to the documentation of this file.
1// Copyright 2024 Intelligent Robotics Lab
2//
3// Licensed under the Apache License, Version 2.0 (the "License");
4// you may not use this file except in compliance with the License.
5// You may obtain a copy of the License at
6//
7// http://www.apache.org/licenses/LICENSE-2.0
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS,
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
14
15#ifndef CS4HOME_CORE__MASTER_HPP_
16#define CS4HOME_CORE__MASTER_HPP_
17
18#include <map>
19#include <string>
20
22
23#include "rclcpp_lifecycle/lifecycle_node.hpp"
24#include "rclcpp/rclcpp.hpp"
25#include "rclcpp/macros.hpp"
26
27namespace cs4home_core
28{
29
35class Master : public rclcpp_lifecycle::LifecycleNode
36{
37public:
38 RCLCPP_SMART_PTR_DEFINITIONS(Master)
39 using CallbackReturnT = rclcpp_lifecycle::node_interfaces::LifecycleNodeInterface::CallbackReturn;
40
45 explicit Master(const rclcpp::NodeOptions & options = rclcpp::NodeOptions());
46
52 CallbackReturnT on_configure(const rclcpp_lifecycle::State & state);
53
59 CallbackReturnT on_activate(const rclcpp_lifecycle::State & state);
60
66 CallbackReturnT on_deactivate(const rclcpp_lifecycle::State & state);
67
73 CallbackReturnT on_cleanup(const rclcpp_lifecycle::State & state);
74
80 CallbackReturnT on_shutdown(const rclcpp_lifecycle::State & state);
81
87 CallbackReturnT on_error(const rclcpp_lifecycle::State & state);
88
89protected:
91 std::map<std::string, cs4home_core::CognitiveModule::SharedPtr> cog_modules_;
92};
93
94} // namespace cs4home_core
95
96#endif // CS4HOME_CORE__MASTER_HPP_
97
98// #include "rclcpp_components/register_node_macro.hpp"
99//
100// // Register the component with class_loader.
101// // This acts as a sort of entry point, allowing the component to be discoverable when its library
102// // is being loaded into a running process.
103// RCLCPP_COMPONENTS_REGISTER_NODE(cs4home_core::Master)
Extends the LifecycleNode to manage cognitive processing components in a ROS 2 lifecycle,...
Definition CognitiveModule.hpp:41
CallbackReturnT on_activate(const rclcpp_lifecycle::State &state)
Activates the Master node.
Definition Master.cpp:50
CallbackReturnT on_configure(const rclcpp_lifecycle::State &state)
Configures the Master node.
Definition Master.cpp:37
std::map< std::string, cs4home_core::CognitiveModule::SharedPtr > cog_modules_
Map of cognitive modules managed by the Master node.
Definition Master.hpp:91
CallbackReturnT on_shutdown(const rclcpp_lifecycle::State &state)
Shuts down the Master node.
Definition Master.cpp:89
Master(const rclcpp::NodeOptions &options=rclcpp::NodeOptions())
Constructs a Master lifecycle node with the specified options.
Definition Master.cpp:24
CallbackReturnT on_cleanup(const rclcpp_lifecycle::State &state)
Cleans up the Master node.
Definition Master.cpp:76
CallbackReturnT on_error(const rclcpp_lifecycle::State &state)
Handles errors in the Master node.
Definition Master.cpp:102
rclcpp_lifecycle::node_interfaces::LifecycleNodeInterface::CallbackReturn CallbackReturnT
Definition Master.hpp:39
CallbackReturnT on_deactivate(const rclcpp_lifecycle::State &state)
Deactivates the Master node.
Definition Master.cpp:63
Definition Afferent.hpp:32