Gazebo Gazebo

API Reference

3.15.2
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 {
39 namespace systems
40 {
41 // Data forward declaration
42 class DoorTimerPrivate;
43 
49 class DoorTimer
50 {
53  public: DoorTimer(const std::chrono::steady_clock::duration &_waitDuration);
54 
56  public: ~DoorTimer();
57 
62  public: void Configure(const std::chrono::steady_clock::duration &_startTime,
63  const std::function<void()> &_timeoutCallback);
64 
69  public: void Update(const UpdateInfo &_info, bool _isDoorwayBlocked);
70 
72  private: std::unique_ptr<DoorTimerPrivate> dataPtr;
73 };
74 
75 } // namespace systems
76 } // namespace IGNITION_GAZEBO_VERSION_NAMESPACE
77 } // namespace gazebo
78 } // namespace ignition
79 
80 #endif // GZ_GAZEBO_SYSTEMS_DOOR_TIMER_HH_
This library is part of the Ignition Robotics project.
Information passed to systems on the update callback.
Definition: include/gz/sim/Types.hh:37
Timer that's used to keep a door open. It has a configurable default wait duration that when exceeded...
Definition: DoorTimer.hh:49
void Update(const UpdateInfo &_info, bool _isDoorwayBlocked)
Checks whether the timer has timed out.
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.