Easy Navigation
Loading...
Searching...
No Matches
SystemNode.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_SYSTEM__SYSTEMNODE_HPP_
19#define EASYNAV_SYSTEM__SYSTEMNODE_HPP_
20
21#include "rclcpp/rclcpp.hpp"
22#include "rclcpp/macros.hpp"
23#include "rclcpp_lifecycle/lifecycle_node.hpp"
24
25#include "geometry_msgs/msg/twist.hpp"
26#include "geometry_msgs/msg/twist_stamped.hpp"
27#include "std_msgs/msg/string.hpp"
28
36
37namespace easynav
38{
39
45{
46 rclcpp_lifecycle::LifecycleNode::SharedPtr node_ptr;
47 rclcpp::CallbackGroup::SharedPtr realtime_cbg;
48};
49
57class SystemNode : public rclcpp_lifecycle::LifecycleNode
58{
59public:
60 RCLCPP_SMART_PTR_DEFINITIONS(SystemNode)
61 using CallbackReturnT = rclcpp_lifecycle::node_interfaces::LifecycleNodeInterface::CallbackReturn;
62
67 explicit SystemNode(const rclcpp::NodeOptions & options = rclcpp::NodeOptions());
68
70 ~SystemNode();
71
77 CallbackReturnT on_configure(const rclcpp_lifecycle::State & state);
78
84 CallbackReturnT on_activate(const rclcpp_lifecycle::State & state);
85
91 CallbackReturnT on_deactivate(const rclcpp_lifecycle::State & state);
92
98 CallbackReturnT on_cleanup(const rclcpp_lifecycle::State & state);
99
105 CallbackReturnT on_shutdown(const rclcpp_lifecycle::State & state);
106
112 CallbackReturnT on_error(const rclcpp_lifecycle::State & state);
113
118 rclcpp::CallbackGroup::SharedPtr get_real_time_cbg();
119
124 std::map<std::string, SystemNodeInfo> get_system_nodes();
125
129 void system_cycle_rt();
130
134 void system_cycle();
135
136private:
138 rclcpp::CallbackGroup::SharedPtr realtime_cbg_;
139
141 ControllerNode::SharedPtr controller_node_;
142
144 LocalizerNode::SharedPtr localizer_node_;
145
147 MapsManagerNode::SharedPtr maps_manager_node_;
148
150 PlannerNode::SharedPtr planner_node_;
151
153 SensorsNode::SharedPtr sensors_node_;
154
156 std::shared_ptr<NavState> nav_state_;
157
159 GoalManager::SharedPtr goal_manager_;
160
162 bool use_cmd_vel_stamped_ {false};
163
165 rclcpp::Publisher<std_msgs::msg::String>::SharedPtr navstate_pub_;
166
168 rclcpp::Publisher<geometry_msgs::msg::TwistStamped>::SharedPtr vel_pub_stamped_;
169
171 rclcpp::Publisher<geometry_msgs::msg::Twist>::SharedPtr vel_pub_;
172};
173
174} // namespace easynav
175
176#endif // EASYNAV_SYSTEM__SYSTEMNODE_HPP_
Declaration of the ControllerNode class, a ROS 2 lifecycle node for speed computation in Easy Navigat...
Declaration of the GoalManager class.
Declaration of the LocalizerNode class, a ROS 2 lifecycle node for localization tasks in Easy Navigat...
Declaration of the MapsManagerNode class, a ROS 2 lifecycle node for map handling in Easy Navigation.
A blackboard-like structure to hold the current state of the navigation system.
Declaration of the PlannerNode class, a ROS 2 lifecycle node for computing navigation paths in Easy N...
Declaration of the SensorsNode class, a ROS 2 lifecycle node for sensor fusion tasks in Easy Navigati...
ROS 2 lifecycle node that manages calculating speeds for the Easy Navigation system.
Definition ControllerNode.hpp:41
Handles navigation goals, their lifecycle, and command interface.
Definition GoalManager.hpp:43
ROS 2 lifecycle node that manages localization in Easy Navigation.
Definition LocalizerNode.hpp:39
ROS 2 lifecycle node that manages map-related plugins in Easy Navigation.
Definition MapsManagerNode.hpp:37
A generic, type-safe, thread-safe blackboard to hold runtime state.
Definition NavState.hpp:82
ROS 2 lifecycle node that manages path planning in Easy Navigation.
Definition PlannerNode.hpp:38
ROS 2 lifecycle node that manages sensor fusion in Easy Navigation.
Definition SensorsNode.hpp:42
CallbackReturnT on_activate(const rclcpp_lifecycle::State &state)
Activate the node.
Definition SystemNode.cpp:139
CallbackReturnT on_configure(const rclcpp_lifecycle::State &state)
Configure the node.
Definition SystemNode.cpp:89
CallbackReturnT on_shutdown(const rclcpp_lifecycle::State &state)
Shutdown the node.
Definition SystemNode.cpp:188
std::map< std::string, SystemNodeInfo > get_system_nodes()
Get all system nodes managed by this coordinator.
Definition SystemNode.cpp:262
CallbackReturnT on_cleanup(const rclcpp_lifecycle::State &state)
Cleanup the node.
Definition SystemNode.cpp:181
rclcpp::CallbackGroup::SharedPtr get_real_time_cbg()
Get the real-time callback group.
Definition SystemNode.cpp:202
CallbackReturnT on_error(const rclcpp_lifecycle::State &state)
Handle lifecycle transition error.
Definition SystemNode.cpp:195
SystemNode(const rclcpp::NodeOptions &options=rclcpp::NodeOptions())
Constructor.
Definition SystemNode.cpp:37
void system_cycle()
Non-real-time system cycle.
Definition SystemNode.cpp:238
void system_cycle_rt()
Real-time system cycle.
Definition SystemNode.cpp:208
rclcpp_lifecycle::node_interfaces::LifecycleNodeInterface::CallbackReturn CallbackReturnT
Definition SystemNode.hpp:61
CallbackReturnT on_deactivate(const rclcpp_lifecycle::State &state)
Deactivate the node.
Definition SystemNode.cpp:160
Definition CircularBuffer.hpp:23
Definition PointPerception.hpp:49
Structure holding runtime information for a subnode.
Definition SystemNode.hpp:45
rclcpp::CallbackGroup::SharedPtr realtime_cbg
Associated real-time callback group.
Definition SystemNode.hpp:47
rclcpp_lifecycle::LifecycleNode::SharedPtr node_ptr
Shared pointer to the managed lifecycle node.
Definition SystemNode.hpp:46