Gazebo Gazebo

API Reference

6.16.0
DoorTimer.hh
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2021 Open Source Robotics Foundation
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  *
16  */
17 
18 /*
19  * \author Nick Lamprianidis <nlamprian@gmail.com>
20  * \date January 2021
21  */
22 
23 #ifndef GZ_GAZEBO_SYSTEMS_DOOR_TIMER_HH_
24 #define GZ_GAZEBO_SYSTEMS_DOOR_TIMER_HH_
25 
26 #include <chrono>
27 #include <functional>
28 #include <memory>
29 
30 #include <gz/sim/System.hh>
31 
32 namespace ignition
33 {
34 namespace gazebo
35 {
36 // Inline bracket to help doxygen filtering
37 inline namespace IGNITION_GAZEBO_VERSION_NAMESPACE {
38 namespace systems
39 {
40 // Data forward declaration
41 class DoorTimerPrivate;
42 
48 class DoorTimer
49 {
52  public: DoorTimer(const std::chrono::steady_clock::duration &_waitDuration);
53 
55  public: ~DoorTimer();
56 
61  public: void Configure(const std::chrono::steady_clock::duration &_startTime,
62  const std::function<void()> &_timeoutCallback);
63 
68  public: void Update(const UpdateInfo &_info, bool _isDoorwayBlocked);
69 
71  private: std::unique_ptr<DoorTimerPrivate> dataPtr;
72 };
73 
74 } // namespace systems
75 } // namespace IGNITION_GAZEBO_VERSION_NAMESPACE
76 } // namespace gazebo
77 } // namespace ignition
78 
79 #endif // GZ_GAZEBO_SYSTEMS_DOOR_TIMER_HH_
This library is part of the Gazebo project.
Information passed to systems on the update callback.
Definition: include/gz/sim/Types.hh:38
void Configure(const std::chrono::steady_clock::duration &_startTime, const std::function< void()> &_timeoutCallback)
Starts the timer and sets the timeout time based on the given start time.
DoorTimer(const std::chrono::steady_clock::duration &_waitDuration)
Constructor.
Timer that's used to keep a door open. It has a configurable default wait duration that when exceeded...
Definition: DoorTimer.hh:48
void Update(const UpdateInfo &_info, bool _isDoorwayBlocked)
Checks whether the timer has timed out.