Easy Navigation
Loading...
Searching...
No Matches
LocalizerNode.hpp
Go to the documentation of this file.
1// Copyright 2025 Intelligent Robotics Lab
2//
3// This file is part of the project Easy Navigation (EasyNav in short)
4// licensed under the GNU General Public License v3.0.
5// See <http://www.gnu.org/licenses/> for details.
6//
7// Easy Navigation program is free software: you can redistribute it and/or modify
8// it under the terms of the GNU General Public License as published by
9// the Free Software Foundation, either version 3 of the License, or
10// (at your option) any later version.
11//
12// This program is distributed in the hope that it will be useful,
13// but WITHOUT ANY WARRANTY; without even the implied warranty of
14// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15// GNU General Public License for more details.
16//
17// You should have received a copy of the GNU General Public License
18// along with this program. If not, see <http://www.gnu.org/licenses/>.
19
22
23#ifndef EASYNAV_LOCALIZER__LOCALIZERNODE_HPP_
24#define EASYNAV_LOCALIZER__LOCALIZERNODE_HPP_
25
26#include "rclcpp/macros.hpp"
27#include "rclcpp_lifecycle/lifecycle_node.hpp"
28#include "pluginlib/class_loader.hpp"
29
30#include "easynav_core/LocalizerMethodBase.hpp"
32
33namespace easynav
34{
35
43class LocalizerNode : public rclcpp_lifecycle::LifecycleNode
44{
45public:
46 RCLCPP_SMART_PTR_DEFINITIONS(LocalizerNode)
47 using CallbackReturnT = rclcpp_lifecycle::node_interfaces::LifecycleNodeInterface::CallbackReturn;
48
53 explicit LocalizerNode(
54 const rclcpp::NodeOptions & options = rclcpp::NodeOptions());
55
58
64 CallbackReturnT on_configure(const rclcpp_lifecycle::State & state);
65
71 CallbackReturnT on_activate(const rclcpp_lifecycle::State & state);
72
78 CallbackReturnT on_deactivate(const rclcpp_lifecycle::State & state);
79
85 CallbackReturnT on_cleanup(const rclcpp_lifecycle::State & state);
86
92 CallbackReturnT on_shutdown(const rclcpp_lifecycle::State & state);
93
99 CallbackReturnT on_error(const rclcpp_lifecycle::State & state);
100
105 rclcpp::CallbackGroup::SharedPtr get_real_time_cbg();
106
113 bool cycle_rt(std::shared_ptr<NavState> nav_state, bool trigger = false);
114
119 void cycle(std::shared_ptr<NavState> nav_state);
120
121private:
123 rclcpp::CallbackGroup::SharedPtr realtime_cbg_;
124
126 std::shared_ptr<LocalizerMethodBase> localizer_method_ {nullptr};
127
129 std::unique_ptr<pluginlib::ClassLoader<easynav::LocalizerMethodBase>> localizer_loader_;
130};
131
132} // namespace easynav
133
134#endif // EASYNAV_LOCALIZER__LOCALIZERNODE_HPP_
A blackboard-like structure to hold the current state of the navigation system.
CallbackReturnT on_activate(const rclcpp_lifecycle::State &state)
Activate the node.
Definition LocalizerNode.cpp:115
CallbackReturnT on_configure(const rclcpp_lifecycle::State &state)
Configure the node.
Definition LocalizerNode.cpp:69
void cycle(std::shared_ptr< NavState > nav_state)
Run a non-real-time localization cycle.
Definition LocalizerNode.cpp:167
CallbackReturnT on_shutdown(const rclcpp_lifecycle::State &state)
Shutdown the node.
Definition LocalizerNode.cpp:138
CallbackReturnT on_cleanup(const rclcpp_lifecycle::State &state)
Clean up the node.
Definition LocalizerNode.cpp:131
bool cycle_rt(std::shared_ptr< NavState > nav_state, bool trigger=false)
Run a real-time localization cycle.
Definition LocalizerNode.cpp:159
rclcpp::CallbackGroup::SharedPtr get_real_time_cbg()
Get the callback group for real-time execution.
Definition LocalizerNode.cpp:152
CallbackReturnT on_error(const rclcpp_lifecycle::State &state)
Handle lifecycle error transition.
Definition LocalizerNode.cpp:145
rclcpp_lifecycle::node_interfaces::LifecycleNodeInterface::CallbackReturn CallbackReturnT
Definition LocalizerNode.hpp:47
LocalizerNode(const rclcpp::NodeOptions &options=rclcpp::NodeOptions())
Constructor.
Definition LocalizerNode.cpp:36
CallbackReturnT on_deactivate(const rclcpp_lifecycle::State &state)
Deactivate the node.
Definition LocalizerNode.cpp:123
A generic, type-safe, lock-free blackboard to hold runtime state.
Definition NavState.hpp:62
Definition RTTFBuffer.hpp:30
Definition PointPerception.hpp:56