Nav2 Navigation Stack - kilted  kilted
ROS 2 Navigation Stack
wait.hpp
1 // Copyright (c) 2019 Samsung Research America
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 #ifndef NAV2_BEHAVIORS__PLUGINS__WAIT_HPP_
16 #define NAV2_BEHAVIORS__PLUGINS__WAIT_HPP_
17 
18 #include <chrono>
19 #include <string>
20 #include <memory>
21 
22 #include "nav2_behaviors/timed_behavior.hpp"
23 #include "nav2_msgs/action/wait.hpp"
24 
25 namespace nav2_behaviors
26 {
27 using WaitAction = nav2_msgs::action::Wait;
28 
33 class Wait : public TimedBehavior<WaitAction>
34 {
35  using CostmapInfoType = nav2_core::CostmapInfoType;
36 
37 public:
38  using WaitActionGoal = WaitAction::Goal;
39 
43  Wait();
44  ~Wait();
45 
51  ResultStatus onRun(const std::shared_ptr<const WaitActionGoal> command) override;
52 
57  ResultStatus onCycleUpdate() override;
58 
63  CostmapInfoType getResourceInfo() override {return CostmapInfoType::LOCAL;}
64 
65 protected:
66  rclcpp::Time wait_end_;
67  WaitAction::Feedback::SharedPtr feedback_;
68 };
69 
70 } // namespace nav2_behaviors
71 
72 #endif // NAV2_BEHAVIORS__PLUGINS__WAIT_HPP_
An action server behavior for waiting a fixed duration.
Definition: wait.hpp:34
ResultStatus onCycleUpdate() override
Loop function to run behavior.
Definition: wait.cpp:37
ResultStatus onRun(const std::shared_ptr< const WaitActionGoal > command) override
Initialization to run behavior.
Definition: wait.cpp:31
Wait()
A constructor for nav2_behaviors::Wait.
Definition: wait.cpp:23
CostmapInfoType getResourceInfo() override
Method to determine the required costmap info.
Definition: wait.hpp:63