AutoAPMS
Resilient Robot Mission Management
Loading...
Searching...
No Matches
executor_server.hpp
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#pragma once
16
17#include "rclcpp/rclcpp.hpp"
19#include "auto_apms_interfaces/action/start_tree_executor.hpp"
20#include "auto_apms_interfaces/action/command_tree_executor.hpp"
23
25{
26
28{
29public:
32
33 static const std::string PARAM_NAME_TREE_BUILDER;
34 static const std::string PARAM_NAME_TICK_RATE;
35 static const std::string PARAM_NAME_GROOT2_PORT;
36 static const std::string PARAM_NAME_STATE_CHANGE_LOGGER;
37 inline static const std::string DEFAULT_NODE_NAME = "tree_executor";
38
44 TreeExecutorServer(const std::string& name, const rclcpp::NodeOptions& options);
45
50 TreeExecutorServer(const rclcpp::NodeOptions& options);
51
52 CreateTreeCallback makeCreateTreeCallback(const std::string& tree_builder_name, const std::string& tree_build_request,
53 const NodeManifest& node_overrides = {});
54
55private:
56 rcl_interfaces::msg::SetParametersResult
57 on_set_parameters_callback_(const std::vector<rclcpp::Parameter>& parameters);
58
59 rclcpp_action::GoalResponse handle_start_goal_(const rclcpp_action::GoalUUID& uuid,
60 std::shared_ptr<const StartActionContext::Goal> goal_ptr);
61 rclcpp_action::CancelResponse handle_start_cancel_(std::shared_ptr<StartActionContext::GoalHandle> goal_handle_ptr);
62 void handle_start_accept_(std::shared_ptr<StartActionContext::GoalHandle> goal_handle_ptr);
63
64 rclcpp_action::GoalResponse handle_command_goal_(const rclcpp_action::GoalUUID& uuid,
65 std::shared_ptr<const CommandActionContext::Goal> goal_ptr);
66 rclcpp_action::CancelResponse
67 handle_command_cancel_(std::shared_ptr<CommandActionContext::GoalHandle> goal_handle_ptr);
68 void handle_command_accept_(std::shared_ptr<CommandActionContext::GoalHandle> goal_handle_ptr);
69
70 bool onTick() override;
71
72 void onTermination(const ExecutionResult& result) override;
73
74 const rclcpp::Logger logger_;
75 const executor_params::ParamListener executor_param_listener_;
76 rclcpp::node_interfaces::OnSetParametersCallbackHandle::SharedPtr on_set_parameters_callback_handle_;
77 TreeBuilderClassLoader tree_build_director_loader_;
78 CreateTreeCallback create_tree_callback_;
79 rclcpp_action::Server<StartActionContext::Type>::SharedPtr start_action_ptr_;
80 StartActionContext start_action_context_;
81 rclcpp_action::Server<CommandActionContext::Type>::SharedPtr command_action_ptr_;
82 CommandActionContext command_action_context_;
83 rclcpp::TimerBase::SharedPtr command_timer_ptr_;
84};
85
86} // namespace auto_apms_behavior_tree
Data structure for resource lookup data and configuration parameters required for loading and registe...
Version of pluginlib::ClassLoader specifically for loading installed behavior tree builder plugins.
static const std::string PARAM_NAME_STATE_CHANGE_LOGGER
auto_apms_core::ActionContext< auto_apms_interfaces::action::StartTreeExecutor > StartActionContext
CreateTreeCallback makeCreateTreeCallback(const std::string &tree_builder_name, const std::string &tree_build_request, const NodeManifest &node_overrides={})
TreeExecutorServer(const std::string &name, const rclcpp::NodeOptions &options)
Constructor for TreeExecutorServer with custom name.
auto_apms_core::ActionContext< auto_apms_interfaces::action::CommandTreeExecutor > CommandActionContext
std::function< Tree(TreeBlackboardSharedPtr)> CreateTreeCallback
Definition executor.hpp:65