AutoAPMS
Streamlining behaviors in ROS 2
Loading...
Searching...
No Matches
options.cpp
1// Copyright 2026 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// http://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_behavior_tree/executor/options.hpp"
16
18{
19
20// --- TreeExecutorNodeOptions ---
21
22TreeExecutorNodeOptions::TreeExecutorNodeOptions(const rclcpp::NodeOptions & ros_node_options)
23: ros_node_options_(ros_node_options)
24{
25}
26
28{
29 enable_command_action_ = enable;
30 return *this;
31}
32
34{
35 enable_clear_blackboard_service_ = enable;
36 return *this;
37}
38
40{
41 scripting_enum_parameters_from_overrides_ = from_overrides;
42 scripting_enum_parameters_dynamic_ = dynamic;
43 return *this;
44}
45
47{
48 blackboard_parameters_from_overrides_ = from_overrides;
49 blackboard_parameters_dynamic_ = dynamic;
50 return *this;
51}
52
54{
55 custom_default_parameters_[_AUTO_APMS_BEHAVIOR_TREE__EXECUTOR_PARAM_BUILD_HANDLER] = rclcpp::ParameterValue(name);
56 return *this;
57}
58
60{
61 command_action_name_ = name;
62 return *this;
63}
64
66{
67 clear_blackboard_service_name_ = name;
68 return *this;
69}
70
72{
73 rclcpp::NodeOptions opt(ros_node_options_);
74 opt.automatically_declare_parameters_from_overrides(
75 scripting_enum_parameters_from_overrides_ || blackboard_parameters_from_overrides_);
76 opt.allow_undeclared_parameters(scripting_enum_parameters_dynamic_ || blackboard_parameters_dynamic_);
77
78 // Default configuration
79 opt.enable_logger_service(true);
80
81 return opt;
82}
83
84} // namespace auto_apms_behavior_tree
TreeExecutorNodeOptions & setCommandActionName(const std::string &name)
Set a custom name for the command tree executor action server.
Definition options.cpp:59
TreeExecutorNodeOptions & enableScriptingEnumParameters(bool from_overrides, bool dynamic)
Configure whether the executor accepts scripting enum parameters.
Definition options.cpp:39
rclcpp::NodeOptions getROSNodeOptions() const
Get the ROS 2 node options that comply with the given options.
Definition options.cpp:71
TreeExecutorNodeOptions & enableClearBlackboardService(bool enable)
Enable or disable the clear blackboard service.
Definition options.cpp:33
TreeExecutorNodeOptions(const rclcpp::NodeOptions &ros_node_options=rclcpp::NodeOptions())
Constructor.
Definition options.cpp:22
TreeExecutorNodeOptions & enableGlobalBlackboardParameters(bool from_overrides, bool dynamic)
Configure whether the executor accepts global blackboard parameters.
Definition options.cpp:46
TreeExecutorNodeOptions & enableCommandAction(bool enable)
Enable or disable the CommandTreeExecutor action interface.
Definition options.cpp:27
TreeExecutorNodeOptions & setClearBlackboardServiceName(const std::string &name)
Set a custom name for the clear blackboard service.
Definition options.cpp:65
TreeExecutorNodeOptions & setDefaultBuildHandler(const std::string &name)
Specify a default behavior tree build handler.
Definition options.cpp:53
Powerful tooling for incorporating behavior trees for task development.
Definition behavior.hpp:32