CARLA
Toggle main menu visibility
Loading...
Searching...
No Matches
LibCarla
source
carla
client
detail
client/detail/ActorState.h
Go to the documentation of this file.
1
// Copyright (c) 2026 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
"
11
#include "
carla/client/ActorAttribute.h
"
12
#include "
carla/client/detail/EpisodeProxy.h
"
13
#include "
carla/rpc/Actor.h
"
14
15
#include <optional>
16
17
namespace
carla
{
18
namespace
client
{
19
namespace
detail
{
20
21
class
ActorFactory
;
22
23
/// Internal state of an Actor.
24
class
ActorState
:
private
MovableNonCopyable
{
25
public
:
26
27
ActorId
GetId
()
const
{
28
return
_description
.
id
;
29
}
30
31
const
std::string &
GetTypeId
()
const
{
32
return
_description
.
description
.
id
;
33
}
34
35
const
std::string &
GetDisplayId
()
const
{
36
return
_display_id
;
37
}
38
39
ActorId
GetParentId
()
const
{
40
return
_description
.
parent_id
;
41
}
42
43
const
std::vector<uint8_t> &
GetSemanticTags
()
const
{
44
return
_description
.
semantic_tags
;
45
}
46
47
SharedPtr<Actor>
GetParent
()
const
;
48
49
World
GetWorld
()
const
{
50
return
World
{
_episode
};
51
}
52
53
const
std::vector<ActorAttributeValue> &
GetAttributes
()
const
54
{
55
return
_attributes
;
56
}
57
58
/// Whether this handle was returned by a spawn call of this client, as
59
/// opposed to being looked up (get_actor, get_actors, parent, spectator).
60
/// Only a spawn handle knows that the actor exists without having seen it
61
/// in a snapshot; see Simulator::GetActorState.
62
bool
WasSpawnedByThisClient
()
const
{
63
return
_spawn_frame
.has_value();
64
}
65
66
/// Frame of the last world snapshot this client had received when the
67
/// spawn of this actor was acknowledged by the server; unset for looked-up
68
/// handles. No snapshot up to this frame can contain the actor yet.
69
uint64_t
GetSpawnFrame
()
const
{
70
return
_spawn_frame
.value_or(0u);
71
}
72
73
protected
:
74
75
explicit
ActorState
(
rpc::Actor
description,
EpisodeProxy
episode);
76
77
const
geom::BoundingBox
&
GetBoundingBox
()
const
{
78
return
_description
.
bounding_box
;
79
}
80
81
const
rpc::Actor
&
GetActorDescription
()
const
{
82
return
_description
;
83
}
84
85
EpisodeProxy
&
GetEpisode
() {
86
return
_episode
;
87
}
88
89
const
EpisodeProxy
&
GetEpisode
()
const
{
90
return
_episode
;
91
}
92
93
private
:
94
95
friend
class
Simulator
;
96
97
rpc::Actor
_description
;
98
99
EpisodeProxy
_episode
;
100
101
std::string
_display_id
;
102
103
std::vector<ActorAttributeValue>
_attributes
;
104
105
std::optional<uint64_t>
_spawn_frame
;
106
};
107
108
}
// namespace detail
109
110
/// Used to initialize Actor classes. Only the ActorFactory can create this
111
/// object, thus only the ActorFactory can create actors.
112
class
ActorInitializer
:
public
detail::ActorState
{
113
public
:
114
ActorInitializer
(
ActorInitializer
&&) =
default
;
115
private
:
116
friend
class
detail::ActorFactory
;
117
using
detail::ActorState::ActorState
;
118
};
119
120
}
// namespace client
121
}
// namespace carla
EpisodeProxy.h
NonCopyable.h
ActorAttribute.h
World.h
carla::MovableNonCopyable::MovableNonCopyable
MovableNonCopyable()=default
carla::client::ActorInitializer::ActorInitializer
ActorInitializer(ActorInitializer &&)=default
carla::client::World
Definition
World.h:45
carla::client::detail::ActorFactory
Definition
ActorFactory.h:21
carla::client::detail::ActorState
Internal state of an Actor.
Definition
client/detail/ActorState.h:24
carla::client::detail::ActorState::GetSemanticTags
const std::vector< uint8_t > & GetSemanticTags() const
Definition
client/detail/ActorState.h:43
carla::client::detail::ActorState::GetId
ActorId GetId() const
Definition
client/detail/ActorState.h:27
carla::client::detail::ActorState::_spawn_frame
std::optional< uint64_t > _spawn_frame
Definition
client/detail/ActorState.h:105
carla::client::detail::ActorState::Simulator
friend class Simulator
Definition
client/detail/ActorState.h:95
carla::client::detail::ActorState::GetEpisode
EpisodeProxy & GetEpisode()
Definition
client/detail/ActorState.h:85
carla::client::detail::ActorState::_display_id
std::string _display_id
Definition
client/detail/ActorState.h:101
carla::client::detail::ActorState::_episode
EpisodeProxy _episode
Definition
client/detail/ActorState.h:99
carla::client::detail::ActorState::_attributes
std::vector< ActorAttributeValue > _attributes
Definition
client/detail/ActorState.h:103
carla::client::detail::ActorState::GetBoundingBox
const geom::BoundingBox & GetBoundingBox() const
Definition
client/detail/ActorState.h:77
carla::client::detail::ActorState::GetParent
SharedPtr< Actor > GetParent() const
Definition
ActorState.cpp:31
carla::client::detail::ActorState::GetAttributes
const std::vector< ActorAttributeValue > & GetAttributes() const
Definition
client/detail/ActorState.h:53
carla::client::detail::ActorState::GetActorDescription
const rpc::Actor & GetActorDescription() const
Definition
client/detail/ActorState.h:81
carla::client::detail::ActorState::ActorState
ActorState(rpc::Actor description, EpisodeProxy episode)
carla::client::detail::ActorState::GetParentId
ActorId GetParentId() const
Definition
client/detail/ActorState.h:39
carla::client::detail::ActorState::GetDisplayId
const std::string & GetDisplayId() const
Definition
client/detail/ActorState.h:35
carla::client::detail::ActorState::GetSpawnFrame
uint64_t GetSpawnFrame() const
Frame of the last world snapshot this client had received when the spawn of this actor was acknowledg...
Definition
client/detail/ActorState.h:69
carla::client::detail::ActorState::WasSpawnedByThisClient
bool WasSpawnedByThisClient() const
Whether this handle was returned by a spawn call of this client, as opposed to being looked up (get_a...
Definition
client/detail/ActorState.h:62
carla::client::detail::ActorState::GetTypeId
const std::string & GetTypeId() const
Definition
client/detail/ActorState.h:31
carla::client::detail::ActorState::GetWorld
World GetWorld() const
Definition
client/detail/ActorState.h:49
carla::client::detail::ActorState::_description
rpc::Actor _description
Definition
client/detail/ActorState.h:97
carla::client::detail::ActorState::GetEpisode
const EpisodeProxy & GetEpisode() const
Definition
client/detail/ActorState.h:89
carla::geom::BoundingBox
Definition
LibCarla/source/carla/geom/BoundingBox.h:26
carla::rpc::ActorDescription::id
std::string id
Definition
LibCarla/source/carla/rpc/ActorDescription.h:32
carla::rpc::Actor
Definition
rpc/Actor.h:20
carla::rpc::Actor::id
ActorId id
Definition
rpc/Actor.h:25
carla::rpc::Actor::semantic_tags
std::vector< uint8_t > semantic_tags
Definition
rpc/Actor.h:33
carla::rpc::Actor::parent_id
ActorId parent_id
Definition
rpc/Actor.h:27
carla::rpc::Actor::description
ActorDescription description
Definition
rpc/Actor.h:29
carla::rpc::Actor::bounding_box
geom::BoundingBox bounding_box
Definition
rpc/Actor.h:31
carla::client::detail
Definition
AtomicList.h:18
carla::client::detail::EpisodeProxy
EpisodeProxyImpl< EpisodeProxyPointerType::Strong > EpisodeProxy
Definition
EpisodeProxy.h:69
carla::client
Definition
BasicAgent.h:24
carla::traffic_manager::ActorId
carla::ActorId ActorId
Definition
AtomicActorSet.h:21
carla
This file contains definitions of common data structures used in traffic manager.
Definition
SignComponent.h:21
carla::SharedPtr
std::shared_ptr< T > SharedPtr
Definition
Memory.h:15
Actor.h
Generated by
1.18.0