PX4 ROS 2 Interface Library
Library to interface with PX4 from a companion computer using ROS 2
action.hpp
1 /****************************************************************************
2  * Copyright (c) 2024 PX4 Development Team.
3  * SPDX-License-Identifier: BSD-3-Clause
4  ****************************************************************************/
5 
6 #pragma once
7 #include <functional>
8 #include <memory>
9 #include <string>
10 #include <vector>
11 #include <px4_ros2/mission/mission.hpp>
12 
13 namespace px4_ros2
14 {
19 class ActionHandler;
20 
26 {
27 public:
28  virtual ~ActionInterface() = default;
29 
30  virtual std::string name() const = 0;
31 
32  virtual bool canRun(const ActionArguments & arguments, std::vector<std::string> & errors)
33  {
34  return true;
35  }
36 
40  virtual bool shouldStopAtWaypoint(const ActionArguments & arguments) {return true;}
41 
47  virtual bool supportsResumeFromLanded() {return false;}
48 
49  virtual void run(
50  const std::shared_ptr<ActionHandler> & handler,
51  const ActionArguments & arguments,
52  const std::function<void()> & on_completed) = 0;
53 
58  virtual void deactivate() {}
59 };
60 
61 
63 } /* namespace px4_ros2 */
Arguments passed to an action from the mission JSON definition.
Definition: mission.hpp:29
Interface class for an action.
Definition: action.hpp:26
virtual bool shouldStopAtWaypoint(const ActionArguments &arguments)
Definition: action.hpp:40
virtual void deactivate()
Definition: action.hpp:58
virtual bool supportsResumeFromLanded()
Definition: action.hpp:47