AutoAPMS
Resilient Robot Mission Management
Loading...
Searching...
No Matches
ros_node_context.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_behavior_tree/node/ros_node_context.hpp
"
16
17
namespace
auto_apms_behavior_tree
18
{
19
RosNodeContext::RosNodeContext
(rclcpp::Node::SharedPtr node_ptr,
const
NodeRegistrationParams
& tree_node_params)
20
: nh(node_ptr)
21
, default_port_name(tree_node_params.port)
22
, wait_for_server_timeout(tree_node_params.wait_timeout)
23
, request_timeout(tree_node_params.request_timeout)
24
{
25
}
26
27
rclcpp::Logger
RosNodeContext::getLogger
()
const
28
{
29
if
(
const
auto
node =
nh
.lock())
30
{
31
return
node->get_logger();
32
}
33
return
rclcpp::get_logger(
"RosTreeNode"
);
34
}
35
36
rclcpp::Time
RosNodeContext::getCurrentTime
()
const
37
{
38
if
(
const
auto
node =
nh
.lock())
39
{
40
return
node->now();
41
}
42
return
rclcpp::Clock(RCL_ROS_TIME).now();
43
}
44
45
}
// namespace auto_apms_behavior_tree
auto_apms_behavior_tree
Definition
tree_builder.hpp:25
ros_node_context.hpp
auto_apms_behavior_tree::NodeRegistrationParams
Behavior tree node registration parameters.
Definition
node_registration_params.hpp:25
auto_apms_behavior_tree::RosNodeContext::RosNodeContext
RosNodeContext(rclcpp::Node::SharedPtr node_ptr, const NodeRegistrationParams &tree_node_params)
Definition
ros_node_context.cpp:19
auto_apms_behavior_tree::RosNodeContext::getCurrentTime
rclcpp::Time getCurrentTime() const
Definition
ros_node_context.cpp:36
auto_apms_behavior_tree::RosNodeContext::nh
std::weak_ptr< rclcpp::Node > nh
Handle for the ROS2 node.
Definition
ros_node_context.hpp:32
auto_apms_behavior_tree::RosNodeContext::getLogger
rclcpp::Logger getLogger() const
Definition
ros_node_context.cpp:27
auto_apms_behavior_tree
src
node
ros_node_context.cpp
Generated by
1.12.0