CARLA
WalkerEvent.h
Go to the documentation of this file.
1 // Copyright (c) 2019 Computer Vision Center (CVC) at the Universitat Autonoma
2 // de Barcelona (UAB).
3 //
4 // This work is licensed under the terms of the MIT license.
5 // For a copy, see <https://opensource.org/licenses/MIT>.
6 
7 #pragma once
8 
9 #ifdef _MSC_VER
10 #pragma warning(push)
11 #pragma warning(disable:4583)
12 #pragma warning(disable:4582)
13 #include <boost/variant2/variant.hpp>
14 #pragma warning(pop)
15 #else
16 #include <boost/variant2/variant.hpp>
17 #endif
18 
19 #include "carla/rpc/ActorId.h"
20 
21 namespace carla {
22 namespace nav {
23 
24  class Navigation;
25  class WalkerManager;
26 
27  /// result of an event
28  enum class EventResult : uint8_t {
29  Continue,
30  End,
31  TimeOut
32  };
33 
34  /// empty event that just ignores
36  };
37 
38  /// event to wait for a while
39  struct WalkerEventWait {
40  double time;
41  WalkerEventWait(double duration) : time(duration) {};
42  };
43 
44  /// event to pause and check for near vehicles
46  double time;
47  WalkerEventStopAndCheck(double duration) : time(duration) {};
48  };
49 
50  /// walker event variant
51  using WalkerEvent = boost::variant2::variant<WalkerEventIgnore, WalkerEventWait, WalkerEventStopAndCheck>;
52 
53  /// visitor class
55  public:
56  WalkerEventVisitor(WalkerManager *manager, ActorId id, double delta) : _manager(manager), _id(id), _delta(delta) {};
57  EventResult operator()(WalkerEventIgnore &event);
58  EventResult operator()(WalkerEventWait &event);
59  EventResult operator()(WalkerEventStopAndCheck &event);
60  private:
61  WalkerManager *_manager { nullptr };
62  ActorId _id { 0 };
63  double _delta { 0 };
64  };
65 
66 } // namespace nav
67 } // namespace carla
WalkerEventVisitor(WalkerManager *manager, ActorId id, double delta)
Definition: WalkerEvent.h:56
event to wait for a while
Definition: WalkerEvent.h:39
rpc::ActorId ActorId
Definition: ActorId.h:18
This file contains definitions of common data structures used in traffic manager. ...
Definition: Carla.cpp:133
EventResult
result of an event
Definition: WalkerEvent.h:28
boost::variant2::variant< WalkerEventIgnore, WalkerEventWait, WalkerEventStopAndCheck > WalkerEvent
walker event variant
Definition: WalkerEvent.h:51
event to pause and check for near vehicles
Definition: WalkerEvent.h:45
WalkerEventWait(double duration)
Definition: WalkerEvent.h:41
empty event that just ignores
Definition: WalkerEvent.h:35
WalkerEventStopAndCheck(double duration)
Definition: WalkerEvent.h:47