CARLA
 
载入中...
搜索中...
未找到
Actor.cpp
浏览该文件的文档.
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
8
9#include "carla/Logging.h"
11
12namespace carla {
13namespace client {
14
15 geom::Location Actor::GetLocation() const {
16 return GetEpisode().Lock()->GetActorLocation(*this);
17 }
18
19 geom::Transform Actor::GetTransform() const {
20 return GetEpisode().Lock()->GetActorTransform(*this);
21 }
22
23 geom::Vector3D Actor::GetVelocity() const {
24 return GetEpisode().Lock()->GetActorVelocity(*this);
25 }
26
27 geom::Vector3D Actor::GetAngularVelocity() const {
28 return GetEpisode().Lock()->GetActorAngularVelocity(*this);
29 }
30
31 geom::Vector3D Actor::GetAcceleration() const {
32 return GetEpisode().Lock()->GetActorAcceleration(*this);
33 }
34
35 geom::Transform Actor::GetComponentWorldTransform(const std::string componentName) const {
36 return GetEpisode().Lock()->GetActorComponentWorldTransform(*this, componentName);
37 }
38
39 geom::Transform Actor::GetComponentRelativeTransform(const std::string componentName) const {
40 return GetEpisode().Lock()->GetActorComponentRelativeTransform(*this, componentName);
41 }
42
43 std::vector<geom::Transform> Actor::GetBoneWorldTransforms() const {
44 return GetEpisode().Lock()->GetActorBoneWorldTransforms(*this);
45 }
46
47 std::vector<geom::Transform> Actor::GetBoneRelativeTransforms() const {
48 return GetEpisode().Lock()->GetActorBoneRelativeTransforms(*this);
49 }
50
51 std::vector<std::string> Actor::GetComponentNames() const {
52 return GetEpisode().Lock()->GetActorComponentNames(*this);
53 }
54
55 std::vector<std::string> Actor::GetBoneNames() const {
56 return GetEpisode().Lock()->GetActorBoneNames(*this);
57 }
58
59 std::vector<geom::Transform> Actor::GetSocketWorldTransforms() const {
60 return GetEpisode().Lock()->GetActorSocketWorldTransforms(*this);
61 }
62
63 std::vector<geom::Transform> Actor::GetSocketRelativeTransforms() const {
64 return GetEpisode().Lock()->GetActorSocketRelativeTransforms(*this);
65 }
66
67 std::vector<std::string> Actor::GetSocketNames() const {
68 return GetEpisode().Lock()->GetActorSocketNames(*this);
69 }
70
71 void Actor::SetLocation(const geom::Location &location) {
72 GetEpisode().Lock()->SetActorLocation(*this, location);
73 }
74
75 void Actor::SetTransform(const geom::Transform &transform) {
76 GetEpisode().Lock()->SetActorTransform(*this, transform);
77 }
78
79 void Actor::SetTargetVelocity(const geom::Vector3D &vector) {
80 GetEpisode().Lock()->SetActorTargetVelocity(*this, vector);
81 }
82
83 void Actor::SetTargetAngularVelocity(const geom::Vector3D &vector) {
84 GetEpisode().Lock()->SetActorTargetAngularVelocity(*this, vector);
85 }
86
87 void Actor::EnableConstantVelocity(const geom::Vector3D &vector) {
88 GetEpisode().Lock()->EnableActorConstantVelocity(*this, vector);
89 }
90
91 void Actor::DisableConstantVelocity() {
92 GetEpisode().Lock()->DisableActorConstantVelocity(*this);
93 }
94
95 void Actor::AddImpulse(const geom::Vector3D &impulse) {
96 GetEpisode().Lock()->AddActorImpulse(*this, impulse);
97 }
98
99 void Actor::AddImpulse(const geom::Vector3D &impulse, const geom::Vector3D &location) {
100 GetEpisode().Lock()->AddActorImpulse(*this, impulse, location);
101 }
102
103 void Actor::AddForce(const geom::Vector3D &force) {
104 GetEpisode().Lock()->AddActorForce(*this, force);
105 }
106
107 void Actor::AddForce(const geom::Vector3D &force, const geom::Vector3D &location) {
108 GetEpisode().Lock()->AddActorForce(*this, force, location);
109 }
110
111 void Actor::AddAngularImpulse(const geom::Vector3D &vector) {
112 GetEpisode().Lock()->AddActorAngularImpulse(*this, vector);
113 }
114
115 void Actor::AddTorque(const geom::Vector3D &torque) {
116 GetEpisode().Lock()->AddActorTorque(*this, torque);
117 }
118
119 void Actor::SetSimulatePhysics(const bool enabled) {
120 GetEpisode().Lock()->SetActorSimulatePhysics(*this, enabled);
121 }
122
123 void Actor::SetCollisions(const bool enabled) {
124 GetEpisode().Lock()->SetActorCollisions(*this, enabled);
125 }
126
127 void Actor::SetActorDead() {
128 GetEpisode().Lock()->SetActorDead(*this);
129 }
130
131 void Actor::SetEnableGravity(const bool enabled) {
132 GetEpisode().Lock()->SetActorEnableGravity(*this, enabled);
133 }
134
135 rpc::ActorState Actor::GetActorState() const {
136 return GetEpisode().Lock()->GetActorState(*this);
137 }
138
139 bool Actor::Destroy() {
140 rpc::ActorState actor_state = GetActorState();
141 bool result = false;
142 if (actor_state != rpc::ActorState::Invalid) {
143 result = GetEpisode().Lock()->DestroyActor(*this);
144 } else {
146 "attempting to destroy an actor that is already dead:",
147 GetDisplayId());
148 }
149 return result;
150 }
151
152} // namespace client
153} // namespace carla
rpc::ActorState GetActorState() const
Definition Actor.cpp:135
const std::string & GetDisplayId() const
SharedPtrType Lock() const
Same as TryLock but never return nullptr.
This file contains definitions of common data structures used in traffic manager.
Definition Carla.cpp:133
static void log_warning(Args &&... args)
Definition Logging.h:96