CARLA
client/detail/ActorState.h
Go to the documentation of this file.
1 // Copyright (c) 2017 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 "carla/NonCopyable.h"
10 #include "carla/client/World.h"
13 #include "carla/rpc/Actor.h"
14 
15 namespace carla {
16 namespace client {
17 namespace detail {
18 
19  class ActorFactory;
20 
21  /// Internal state of an Actor.
22  class ActorState : private MovableNonCopyable {
23  public:
24 
25  ActorId GetId() const {
26  return _description.id;
27  }
28 
29  const std::string &GetTypeId() const {
31  }
32 
33  const std::string &GetDisplayId() const {
34  return _display_id;
35  }
36 
37  ActorId GetParentId() const {
38  return _description.parent_id;
39  }
40 
41  const std::vector<uint8_t> &GetSemanticTags() const {
43  }
44 
46 
47  World GetWorld() const {
48  return World{_episode};
49  }
50 
51  const std::vector<ActorAttributeValue> &GetAttributes() const
52  {
53  return _attributes;
54  }
55 
56  protected:
57 
58  explicit ActorState(rpc::Actor description, EpisodeProxy episode);
59 
62  }
63 
65  return _description;
66  }
67 
69  return _episode;
70  }
71 
72  const EpisodeProxy &GetEpisode() const {
73  return _episode;
74  }
75 
76  private:
77 
78  friend class Simulator;
79 
81 
83 
84  std::string _display_id;
85 
86  std::vector<ActorAttributeValue> _attributes;
87  };
88 
89 } // namespace detail
90 
91  /// Used to initialize Actor classes. Only the ActorFactory can create this
92  /// object, thus only the ActorFactory can create actors.
94  public:
95  ActorInitializer(ActorInitializer &&) = default;
96  private:
97  friend class detail::ActorFactory;
99  };
100 
101 } // namespace client
102 } // namespace carla
boost::shared_ptr< T > SharedPtr
Use this SharedPtr (boost::shared_ptr) to keep compatibility with boost::python, but it would be nice...
Definition: Memory.h:20
This file contains definitions of common data structures used in traffic manager. ...
Definition: Carla.cpp:133
const std::string & GetTypeId() const
ActorDescription description
Definition: rpc/Actor.h:29
const std::string & GetDisplayId() const
Used to initialize Actor classes.
geom::BoundingBox bounding_box
Definition: rpc/Actor.h:31
Inherit (privately) to suppress copy construction and assignment.
Connects and controls a CARLA Simulator.
Definition: Simulator.h:49
const geom::BoundingBox & GetBoundingBox() const
carla::ActorId ActorId
const std::vector< uint8_t > & GetSemanticTags() const
std::vector< uint8_t > semantic_tags
Definition: rpc/Actor.h:33
SharedPtr< Actor > GetParent() const
Definition: ActorState.cpp:31
const EpisodeProxy & GetEpisode() const
ActorState(rpc::Actor description, EpisodeProxy episode)
ActorId parent_id
Definition: rpc/Actor.h:27
std::vector< ActorAttributeValue > _attributes
const std::vector< ActorAttributeValue > & GetAttributes() const
const rpc::Actor & GetActorDescription() const