roboligo
Loading...
Searching...
No Matches
StatesNode.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_STATES__STATESNODE_HPP_
16#define ROBOLIGO_STATES__STATESNODE_HPP_
17
18#include "pluginlib/class_loader.hpp"
19
20#include "rclcpp/macros.hpp"
21#include "rclcpp_lifecycle/lifecycle_node.hpp"
22
25
26namespace roboligo
27{
34 class StatesNode : public rclcpp_lifecycle::LifecycleNode
35 {
36 public:
37
38 RCLCPP_SMART_PTR_DEFINITIONS(StatesNode)
39 using CallbackReturnT = rclcpp_lifecycle::node_interfaces::LifecycleNodeInterface::CallbackReturn;
40
45 explicit StatesNode(
46 const rclcpp::NodeOptions & options = rclcpp::NodeOptions());
47
51 ~StatesNode();
52
58 CallbackReturnT on_configure(const rclcpp_lifecycle::State & state);
59
65 CallbackReturnT on_activate(const rclcpp_lifecycle::State & state);
66
72 CallbackReturnT on_deactivate(const rclcpp_lifecycle::State & state);
73
79 CallbackReturnT on_cleanup(const rclcpp_lifecycle::State & state);
80
86 CallbackReturnT on_shutdown(const rclcpp_lifecycle::State & state);
87
93 CallbackReturnT on_error(const rclcpp_lifecycle::State & state);
94
100 bool init(std::shared_ptr<RobotState> robot_state);
101
107 bool cycle(std::shared_ptr<RobotState> robot_state);
108
112 void reset_classification(void);
113
114 private:
115
116 std::shared_ptr<ClassificationBase> classification_ {nullptr};
117
118 const std::shared_ptr<const RobotState> robot_state_;
119
120 std::unique_ptr<pluginlib::ClassLoader<roboligo::ClassificationBase>> classification_loader_;
121 };
122
123} // namespace roboligo
124
125#endif // ROBOLIGO_STATES__STATESNODE_HPP_
Base class for classification plugins in the Roboligo system.
Definition ClassificationBase.hpp:38
Represents the state and configuration of a robot.
Definition RobotState.hpp:45
CallbackReturnT on_activate(const rclcpp_lifecycle::State &state)
Instructions on_active state.
Definition StatesNode.cpp:95
void reset_classification(void)
When the node is in shutdowning, this method is called.
Definition StatesNode.cpp:147
CallbackReturnT on_cleanup(const rclcpp_lifecycle::State &state)
Instructions on_cleanup state.
Definition StatesNode.cpp:107
CallbackReturnT on_error(const rclcpp_lifecycle::State &state)
Instructions on_error state.
Definition StatesNode.cpp:127
StatesNode(const rclcpp::NodeOptions &options=rclcpp::NodeOptions())
Constructor for StatesNode.
Definition StatesNode.cpp:27
bool cycle(std::shared_ptr< RobotState > robot_state)
Method used for each iteration.
Definition StatesNode.cpp:140
CallbackReturnT on_configure(const rclcpp_lifecycle::State &state)
Instructions on_configure state.
Definition StatesNode.cpp:51
CallbackReturnT on_shutdown(const rclcpp_lifecycle::State &state)
Instructions on_shutdown state.
Definition StatesNode.cpp:113
bool init(std::shared_ptr< RobotState > robot_state)
Method called at initialize and configurate settings.
Definition StatesNode.cpp:133
rclcpp_lifecycle::node_interfaces::LifecycleNodeInterface::CallbackReturn CallbackReturnT
Definition StatesNode.hpp:39
CallbackReturnT on_deactivate(const rclcpp_lifecycle::State &state)
Instructions on_deactivate state.
Definition StatesNode.cpp:101
Definition ClassificationBase.hpp:28