PX4 ROS 2 Interface Library
Library to interface with PX4 from a companion computer using ROS 2
navigation_interface_base.hpp
1 /****************************************************************************
2  * Copyright (c) 2023 PX4 Development Team.
3  * SPDX-License-Identifier: BSD-3-Clause
4  ****************************************************************************/
5 
6 #pragma once
7 
8 #include <px4_ros2/common/context.hpp>
9 
10 namespace px4_ros2
11 {
12 
16 class NavigationInterfaceInvalidArgument : public std::invalid_argument
17 {
18 public:
19  explicit NavigationInterfaceInvalidArgument(const std::string & message)
20  : std::invalid_argument("PX4 ROS2 navigation interface: invalid argument: " + message) {}
21 };
22 
27 {
28 public:
30  rclcpp::Node & node,
31  std::string topic_namespace_prefix = "")
32  : Context(node, std::move(topic_namespace_prefix)), _node(node) {}
33  virtual ~PositionMeasurementInterfaceBase() = default;
34 
39  bool doRegister()
40  {
41  return true;
42  }
43 
44 protected:
45  rclcpp::Node & _node;
46 };
47 
48 } // namespace px4_ros2
Definition: context.hpp:20
Thrown to report invalid arguments to measurement interface.
Definition: navigation_interface_base.hpp:17
Base class for position measurement interface.
Definition: navigation_interface_base.hpp:27
bool doRegister()
Definition: navigation_interface_base.hpp:39