mrs_lib
Various reusable classes, functions and utilities for use in MRS projects
Loading...
Searching...
No Matches
node.h
1#pragma once
2
3#include <memory>
4#include <string>
5
6#include <rclcpp/rclcpp.hpp>
7
8namespace mrs_lib
9{
10
11class Node {
12
13protected:
14 explicit Node(const std::string& node_name, const rclcpp::NodeOptions& options = rclcpp::NodeOptions()) : node_(std::make_shared<rclcpp::Node>(node_name, options)) {
15 }
16
17 explicit Node(const std::string& node_name, const std::string& namespace_, const rclcpp::NodeOptions& options = rclcpp::NodeOptions())
18 : node_(std::make_shared<rclcpp::Node>(node_name, namespace_, options)) {
19 }
20
21 ~Node() = default;
22 Node(const Node&) = delete;
23 Node& operator=(const Node&) = delete;
24 Node(Node&&) = delete;
25 Node& operator=(Node&&) = delete;
26
27 [[nodiscard]] rclcpp::Node& this_node() noexcept {
28 return *node_;
29 }
30 [[nodiscard]] const rclcpp::Node& this_node() const noexcept {
31 return *node_;
32 }
33 [[nodiscard]] rclcpp::Node::SharedPtr this_node_ptr() const noexcept {
34 return node_;
35 }
36
37public:
38 rclcpp::node_interfaces::NodeBaseInterface::SharedPtr get_node_base_interface() {
39 return node_->get_node_base_interface();
40 }
41
42private:
43 rclcpp::Node::SharedPtr node_;
44};
45
46} // namespace mrs_lib
Definition node.h:11
All mrs_lib functions, classes, variables and definitions are contained in this namespace.
Definition attitude_converter.h:24