AutoAPMS
Resilient Robot Mission Management
Loading...
Searching...
No Matches
mission.cpp
Go to the documentation of this file.
1// Copyright 2024 Robin Müller
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#include "auto_apms_interfaces/action/mission.hpp"
16
18
19#define INPUT_KEY_DO_RESTART "do_restart"
20
21namespace auto_apms_px4
22{
23
24class MissionAction : public auto_apms_behavior_tree::RosActionNode<auto_apms_interfaces::action::Mission>
25{
26public:
27 using RosActionNode::RosActionNode;
28
29 static BT::PortsList providedPorts()
30 {
31 return providedBasicPorts({ BT::InputPort<bool>(INPUT_KEY_DO_RESTART, false,
32 "Wether to restart (true) or resume (false) the mission.") });
33 }
34
35 bool setGoal(Goal& goal)
36 {
37 goal.do_restart = getInput<bool>(INPUT_KEY_DO_RESTART).value();
38 return true;
39 }
40};
41
42} // namespace auto_apms_px4
43
44AUTO_APMS_BEHAVIOR_TREE_REGISTER_NODE(auto_apms_px4::MissionAction)
#define INPUT_KEY_DO_RESTART
Definition mission.cpp:19
Abstract class to wrap rclcpp_action::Client<>
#define AUTO_APMS_BEHAVIOR_TREE_REGISTER_NODE(type)
Macro for registering a behavior tree node plugin.
Definition node.hpp:30