roboligo
Loading...
Searching...
No Matches
RoboligoNode.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_SYSTEM__ROBOLIGONODE_HPP_
16#define ROBOLIGO_SYSTEM__ROBOLIGONODE_HPP_
17
18#include <functional>
19
20#include "rclcpp/macros.hpp"
21#include "rclcpp/rclcpp.hpp"
22#include "rclcpp_lifecycle/lifecycle_node.hpp"
23#include "lifecycle_msgs/msg/transition.hpp"
24#include "lifecycle_msgs/msg/state.hpp"
25
26#include "roboligo_interfaces/srv/roboligo_string.hpp"
27
28#include <geometry_msgs/msg/twist_stamped.hpp>
29
31
33
36
38
39
40namespace roboligo
41{
47 {
48 rclcpp_lifecycle::LifecycleNode::SharedPtr node_ptr;
49 rclcpp::CallbackGroup::SharedPtr cbg;
50 };
51
59 class RoboligoNode : public rclcpp_lifecycle::LifecycleNode
60 {
61 public:
62 RCLCPP_SMART_PTR_DEFINITIONS(RoboligoNode)
63 using CallbackReturnT = rclcpp_lifecycle::node_interfaces::LifecycleNodeInterface::CallbackReturn;
64
69 explicit RoboligoNode(const rclcpp::NodeOptions & options = rclcpp::NodeOptions());
70
74 ~RoboligoNode();
75
81 CallbackReturnT on_configure(const rclcpp_lifecycle::State & state);
82
88 CallbackReturnT on_activate(const rclcpp_lifecycle::State & state);
89
95 CallbackReturnT on_deactivate(const rclcpp_lifecycle::State & state);
96
102 CallbackReturnT on_cleanup(const rclcpp_lifecycle::State & state);
103
109 CallbackReturnT on_shutdown(const rclcpp_lifecycle::State & state);
110
116 CallbackReturnT on_error(const rclcpp_lifecycle::State & state);
117
122 std::map<std::string, RoboligoNodeInfo> get_roboligo_system_nodes();
123
127 rclcpp::Service<roboligo_interfaces::srv::RoboligoString>::SharedPtr input_command;
128
132 void roboligo_init();
133
137 void roboligo_cycle();
138
142 void preShutdown();
143
149 void input_callback(const std::shared_ptr<roboligo_interfaces::srv::RoboligoString::Request> request,
150 std::shared_ptr<roboligo_interfaces::srv::RoboligoString::Response> response);
151
152 private:
153
154 StatesNode::SharedPtr states_node_ = StatesNode::make_shared();
155
156 ConnectorNode::SharedPtr connector_node_ = ConnectorNode::make_shared();
157
158 std::shared_ptr<RobotState> robot_state_ = std::make_shared<RobotState>();
159
160 std::string input_topic_{"/cmd_vel"};
161
162 std::string robot_name_;
163
164 bool stamped_{false};
165
166 };
167
168} // namespace roboligo
169
170#endif // ROBOLIGO_SYSTEM__ROBOLIGONODE_HPP_
A lifecycle node that manages the robot connector.
Definition ConnectorNode.hpp:36
CallbackReturnT on_deactivate(const rclcpp_lifecycle::State &state)
Instructions on_deactive state.
Definition RoboligoNode.cpp:166
void preShutdown()
preShutdown method is defined to configure lifecycle node before than shutdown
Definition RoboligoNode.cpp:39
CallbackReturnT on_error(const rclcpp_lifecycle::State &state)
Instructions on_error state.
Definition RoboligoNode.cpp:205
std::map< std::string, RoboligoNodeInfo > get_roboligo_system_nodes()
method to obtain updated information about nodes, overall Nodes names
Definition RoboligoNode.cpp:245
void roboligo_init()
Initalize method, into are call init method of another nodes.
Definition RoboligoNode.cpp:212
rclcpp_lifecycle::node_interfaces::LifecycleNodeInterface::CallbackReturn CallbackReturnT
Definition RoboligoNode.hpp:63
CallbackReturnT on_activate(const rclcpp_lifecycle::State &state)
Instructions on_activate state.
Definition RoboligoNode.cpp:143
rclcpp::Service< roboligo_interfaces::srv::RoboligoString >::SharedPtr input_command
Service to read the input command.
Definition RoboligoNode.hpp:127
void roboligo_cycle()
Cycle method, into are call cycle method of another nodes.
Definition RoboligoNode.cpp:220
CallbackReturnT on_configure(const rclcpp_lifecycle::State &state)
Instructions on_configure state.
Definition RoboligoNode.cpp:55
CallbackReturnT on_cleanup(const rclcpp_lifecycle::State &state)
Instructions on_cleanup state.
Definition RoboligoNode.cpp:189
void input_callback(const std::shared_ptr< roboligo_interfaces::srv::RoboligoString::Request > request, std::shared_ptr< roboligo_interfaces::srv::RoboligoString::Response > response)
callback method for service input_command
Definition RoboligoNode.cpp:227
RoboligoNode(const rclcpp::NodeOptions &options=rclcpp::NodeOptions())
Constructor.
Definition RoboligoNode.cpp:22
CallbackReturnT on_shutdown(const rclcpp_lifecycle::State &state)
Instructions on_shutdown state.
Definition RoboligoNode.cpp:197
Represents the state and configuration of a robot.
Definition RobotState.hpp:45
A service commander that extends the Commander interface.
Definition Service.hpp:32
A lifecycle node that manages the configuration robot.
Definition StatesNode.hpp:35
Definition ClassificationBase.hpp:28
Contains information about a managed Roboligo lifecycle node.
Definition RoboligoNode.hpp:47
rclcpp_lifecycle::LifecycleNode::SharedPtr node_ptr
Shared pointer to the managed lifecycle node.
Definition RoboligoNode.hpp:48
rclcpp::CallbackGroup::SharedPtr cbg
Shared pointer to callbackgroup.
Definition RoboligoNode.hpp:49