Easy Navigation
Loading...
Searching...
No Matches
ControllerNode.hpp
Go to the documentation of this file.
1// Copyright 2025 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
17
18#ifndef EASYNAV_CONTROLLER__CONTROLLERNODE_HPP_
19#define EASYNAV_CONTROLLER__CONTROLLERNODE_HPP_
20
21#include "rclcpp/macros.hpp"
22#include "rclcpp_lifecycle/lifecycle_node.hpp"
23#include "easynav_core/ControllerMethodBase.hpp"
24#include "pluginlib/class_loader.hpp"
25
26namespace easynav
27{
28
31
39
40class ControllerNode : public rclcpp_lifecycle::LifecycleNode
41{
42public:
43 RCLCPP_SMART_PTR_DEFINITIONS(ControllerNode)
44 using CallbackReturnT = rclcpp_lifecycle::node_interfaces::LifecycleNodeInterface::CallbackReturn;
45
50 explicit ControllerNode(
51 const rclcpp::NodeOptions & options = rclcpp::NodeOptions());
52
57
65 CallbackReturnT on_configure(const rclcpp_lifecycle::State & state);
66
74 CallbackReturnT on_activate(const rclcpp_lifecycle::State & state);
75
83 CallbackReturnT on_deactivate(const rclcpp_lifecycle::State & state);
84
92 CallbackReturnT on_cleanup(const rclcpp_lifecycle::State & state);
93
101 CallbackReturnT on_shutdown(const rclcpp_lifecycle::State & state);
102
110 CallbackReturnT on_error(const rclcpp_lifecycle::State & state);
111
120 rclcpp::CallbackGroup::SharedPtr get_real_time_cbg();
121
130 bool cycle_rt(std::shared_ptr<NavState> nav_state, bool trigger = false);
131
132private:
136 rclcpp::CallbackGroup::SharedPtr realtime_cbg_;
137
143 std::shared_ptr<ControllerMethodBase> controller_method_ {nullptr};
144
150 const std::shared_ptr<const NavState> nav_state_;
151
158 std::unique_ptr<pluginlib::ClassLoader<easynav::ControllerMethodBase>> controller_loader_;
159};
160
161} // namespace easynav
162
163#endif // EASYNAV_CONTROLLER__CONTROLLERNODE_HPP_
CallbackReturnT on_activate(const rclcpp_lifecycle::State &state)
Activates the ControllerNode node.
Definition ControllerNode.cpp:123
CallbackReturnT on_configure(const rclcpp_lifecycle::State &state)
Configures the ControllerNode node.
Definition ControllerNode.cpp:79
CallbackReturnT on_shutdown(const rclcpp_lifecycle::State &state)
Shuts down the ControllerNode node.
Definition ControllerNode.cpp:141
CallbackReturnT on_cleanup(const rclcpp_lifecycle::State &state)
Cleans up the ControllerNode node.
Definition ControllerNode.cpp:135
ControllerNode(const rclcpp::NodeOptions &options=rclcpp::NodeOptions())
Constructs a ControllerNode lifecycle node with the specified options.
Definition ControllerNode.cpp:31
bool cycle_rt(std::shared_ptr< NavState > nav_state, bool trigger=false)
Executes one cycle of real-time controller logic.
Definition ControllerNode.cpp:159
rclcpp::CallbackGroup::SharedPtr get_real_time_cbg()
Returns the real-time callback group.
Definition ControllerNode.cpp:153
CallbackReturnT on_error(const rclcpp_lifecycle::State &state)
Handles errors in the ControllerNode node.
Definition ControllerNode.cpp:147
rclcpp_lifecycle::node_interfaces::LifecycleNodeInterface::CallbackReturn CallbackReturnT
Definition ControllerNode.hpp:44
CallbackReturnT on_deactivate(const rclcpp_lifecycle::State &state)
Deactivates the ControllerNode node.
Definition ControllerNode.cpp:129
A generic, type-safe, thread-safe blackboard to hold runtime state.
Definition NavState.hpp:82
Definition CircularBuffer.hpp:23
Definition PointPerception.hpp:49