AutoAPMS
Resilient Robot Mission Management
Loading...
Searching...
No Matches
takeoff.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/takeoff.hpp"
16
18
19#define INPUT_KEY_ALTITUDE "alt"
20
21namespace auto_apms_px4
22{
23
24class TakeoffAction : public auto_apms_behavior_tree::RosActionNode<auto_apms_interfaces::action::Takeoff>
25{
26public:
27 using RosActionNode::RosActionNode;
28
29 static BT::PortsList providedPorts()
30 {
31 return providedBasicPorts({ BT::InputPort<double>(INPUT_KEY_ALTITUDE, "Target takeoff altitude in meter (AMSL)") });
32 }
33
34 bool setGoal(Goal& goal)
35 {
36 goal.altitude_amsl_m = getInput<double>(INPUT_KEY_ALTITUDE).value();
37 return true;
38 }
39};
40
41} // namespace auto_apms_px4
42
43AUTO_APMS_BEHAVIOR_TREE_REGISTER_NODE(auto_apms_px4::TakeoffAction)
#define INPUT_KEY_ALTITUDE
Definition goto.cpp:20
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