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 #include <boost/variant.hpp>
10 
11 #include "carla/rpc/ActorId.h"
12 
13 namespace carla {
14 namespace nav {
15 
16  class Navigation;
17  class WalkerManager;
18 
19  /// result of an event
20  enum class EventResult : uint8_t {
21  Continue,
22  End,
23  TimeOut
24  };
25 
26  /// empty event that just ignores
28  };
29 
30  /// event to wait for a while
31  struct WalkerEventWait {
32  double time;
33  WalkerEventWait(double duration) : time(duration) {};
34  };
35 
36  /// event to pause and check for near vehicles
38  double time;
39  WalkerEventStopAndCheck(double duration) : time(duration) {};
40  };
41 
42  /// walker event variant
43  using WalkerEvent = boost::variant<WalkerEventIgnore, WalkerEventWait, WalkerEventStopAndCheck>;
44 
45  /// visitor class
47  public:
48  WalkerEventVisitor(WalkerManager *manager, ActorId id, double delta) : _manager(manager), _id(id), _delta(delta) {};
49  EventResult operator()(WalkerEventIgnore &event);
50  EventResult operator()(WalkerEventWait &event);
51  EventResult operator()(WalkerEventStopAndCheck &event);
52  private:
53  WalkerManager *_manager { nullptr };
54  ActorId _id { 0 };
55  double _delta { 0 };
56  };
57 
58 } // namespace nav
59 } // namespace carla
WalkerEventVisitor(WalkerManager *manager, ActorId id, double delta)
Definition: WalkerEvent.h:48
event to wait for a while
Definition: WalkerEvent.h:31
boost::variant< WalkerEventIgnore, WalkerEventWait, WalkerEventStopAndCheck > WalkerEvent
walker event variant
Definition: WalkerEvent.h:43
rpc::ActorId ActorId
Definition: ActorId.h:18
This file contains definitions of common data structures used in traffic manager. ...
Definition: Carla.cpp:99
EventResult
result of an event
Definition: WalkerEvent.h:20
event to pause and check for near vehicles
Definition: WalkerEvent.h:37
WalkerEventWait(double duration)
Definition: WalkerEvent.h:33
empty event that just ignores
Definition: WalkerEvent.h:27
WalkerEventStopAndCheck(double duration)
Definition: WalkerEvent.h:39