roboligo
Loading...
Searching...
No Matches
PluginBase.hpp
Go to the documentation of this file.
1// Copyright 2026 Juan S. Cely G.
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// https://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 ROBOLIGO_COMMON_TYPES__PLUGINBASE_HPP_
16#define ROBOLIGO_COMMON_TYPES__PLUGINBASE_HPP_
17
18#include <memory>
19#include <string>
20
21#include "rclcpp_lifecycle/lifecycle_node.hpp"
22
23namespace roboligo
24{
33 {
34 public:
38 PluginBase() = default;
39
43 virtual ~PluginBase() = default;
44
51 virtual void initialize(
52 const std::shared_ptr<rclcpp_lifecycle::LifecycleNode> parent_node,
53 const std::string & plugin_name);
54
58 virtual void on_initialize() {}
59
66 [[nodiscard]] std::shared_ptr<rclcpp_lifecycle::LifecycleNode> get_node() const;
67
74 [[nodiscard]] const std::string & get_plugin_name() const;
75
76 private:
77
78 std::shared_ptr<rclcpp_lifecycle::LifecycleNode> parent_node_ {nullptr};
79
80 std::string plugin_name_;
81
82 float frequency_{10.0};
83 };
84
85} // namespace roboligo
86#endif // ROBOLIGO_COMMON_TYPES__PLUGINBASE_HPP_
std::shared_ptr< rclcpp_lifecycle::LifecycleNode > get_node() const
Retrieves the parent lifecycle node.
Definition PluginBase.cpp:34
const std::string & get_plugin_name() const
Retrieves the plugin name.
Definition PluginBase.cpp:40
virtual void initialize(const std::shared_ptr< rclcpp_lifecycle::LifecycleNode > parent_node, const std::string &plugin_name)
Initializes the plugin with a parent lifecycle node and plugin name.
Definition PluginBase.cpp:20
PluginBase()=default
Default constructor.
virtual ~PluginBase()=default
Virtual destructor for proper cleanup of derived classes.
virtual void on_initialize()
Called during plugin initialization. Override in derived classes for custom setup.
Definition PluginBase.hpp:58
Definition ClassificationBase.hpp:28