Easy Navigation
Loading...
Searching...
No Matches
LocalizerNode.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_LOCALIZER__LOCALIZERNODE_HPP_
19#define EASYNAV_LOCALIZER__LOCALIZERNODE_HPP_
20
21#include "rclcpp/macros.hpp"
22#include "rclcpp_lifecycle/lifecycle_node.hpp"
23#include "pluginlib/class_loader.hpp"
24
25#include "easynav_core/LocalizerMethodBase.hpp"
27
28namespace easynav
29{
30
38class LocalizerNode : public rclcpp_lifecycle::LifecycleNode
39{
40public:
41 RCLCPP_SMART_PTR_DEFINITIONS(LocalizerNode)
42 using CallbackReturnT = rclcpp_lifecycle::node_interfaces::LifecycleNodeInterface::CallbackReturn;
43
48 explicit LocalizerNode(
49 const rclcpp::NodeOptions & options = rclcpp::NodeOptions());
50
53
59 CallbackReturnT on_configure(const rclcpp_lifecycle::State & state);
60
66 CallbackReturnT on_activate(const rclcpp_lifecycle::State & state);
67
73 CallbackReturnT on_deactivate(const rclcpp_lifecycle::State & state);
74
80 CallbackReturnT on_cleanup(const rclcpp_lifecycle::State & state);
81
87 CallbackReturnT on_shutdown(const rclcpp_lifecycle::State & state);
88
94 CallbackReturnT on_error(const rclcpp_lifecycle::State & state);
95
100 rclcpp::CallbackGroup::SharedPtr get_real_time_cbg();
101
108 bool cycle_rt(std::shared_ptr<NavState> nav_state, bool trigger = false);
109
114 void cycle(std::shared_ptr<NavState> nav_state);
115
116private:
118 rclcpp::CallbackGroup::SharedPtr realtime_cbg_;
119
121 std::shared_ptr<LocalizerMethodBase> localizer_method_ {nullptr};
122
124 std::unique_ptr<pluginlib::ClassLoader<easynav::LocalizerMethodBase>> localizer_loader_;
125};
126
127} // namespace easynav
128
129#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:107
CallbackReturnT on_configure(const rclcpp_lifecycle::State &state)
Configure the node.
Definition LocalizerNode.cpp:63
void cycle(std::shared_ptr< NavState > nav_state)
Run a non-real-time localization cycle.
Definition LocalizerNode.cpp:152
CallbackReturnT on_shutdown(const rclcpp_lifecycle::State &state)
Shutdown the node.
Definition LocalizerNode.cpp:125
CallbackReturnT on_cleanup(const rclcpp_lifecycle::State &state)
Clean up the node.
Definition LocalizerNode.cpp:119
bool cycle_rt(std::shared_ptr< NavState > nav_state, bool trigger=false)
Run a real-time localization cycle.
Definition LocalizerNode.cpp:144
rclcpp::CallbackGroup::SharedPtr get_real_time_cbg()
Get the callback group for real-time execution.
Definition LocalizerNode.cpp:137
CallbackReturnT on_error(const rclcpp_lifecycle::State &state)
Handle lifecycle error transition.
Definition LocalizerNode.cpp:131
rclcpp_lifecycle::node_interfaces::LifecycleNodeInterface::CallbackReturn CallbackReturnT
Definition LocalizerNode.hpp:42
LocalizerNode(const rclcpp::NodeOptions &options=rclcpp::NodeOptions())
Constructor.
Definition LocalizerNode.cpp:30
CallbackReturnT on_deactivate(const rclcpp_lifecycle::State &state)
Deactivate the node.
Definition LocalizerNode.cpp:113
A generic, type-safe, thread-safe blackboard to hold runtime state.
Definition NavState.hpp:82
Definition CircularBuffer.hpp:23
Definition PointPerception.hpp:49