CARLA
 
载入中...
搜索中...
未找到
Command.h
浏览该文件的文档.
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/MsgPack.h"
14#include "carla/rpc/ActorId.h"
21
22#include <string>
23
24#ifdef _MSC_VER
25#pragma warning(push)
26#pragma warning(disable:4583)
27#pragma warning(disable:4582)
28#include <boost/variant2/variant.hpp>
29#pragma warning(pop)
30#else
31#include <boost/variant2/variant.hpp>
32#endif
33
34namespace carla {
35
36namespace traffic_manager {
37 class TrafficManager;
38}
39
40namespace ctm = carla::traffic_manager;
41
42namespace rpc {
43
44 class Command {
45 private:
46
47 template <typename T>
48 struct CommandBase {
49 operator Command() const {
50 return Command{*static_cast<const T *>(this)};
51 }
52 };
53
54 public:
55
79
80 struct DestroyActor : CommandBase<DestroyActor> {
81 DestroyActor() = default;
83 : actor(id) {}
86 };
87
97
107
117
127
137
147
156
166
176
186
187 struct ApplyForce : CommandBase<ApplyForce> {
188 ApplyForce() = default;
190 : actor(id),
191 force(value) {}
195 };
196
206
216
217 struct SetSimulatePhysics : CommandBase<SetSimulatePhysics> {
220 : actor(id),
221 enabled(value) {}
225 };
226
227 struct SetEnableGravity : CommandBase<SetEnableGravity> {
228 SetEnableGravity() = default;
229 SetEnableGravity(ActorId id, bool value)
230 : actor(id),
231 enabled(value) {}
235 };
236
237 struct SetAutopilot : CommandBase<SetAutopilot> {
238 SetAutopilot() = default;
240 ActorId id,
241 bool value,
242 uint16_t tm_port)
243 : actor(id),
244 enabled(value),
245 tm_port(tm_port) {}
248 uint16_t tm_port;
250 };
251
252 struct ShowDebugTelemetry : CommandBase<ShowDebugTelemetry> {
255 ActorId id,
256 bool value)
257 : actor(id),
258 enabled(value) {}
262 };
263
275
276 struct ConsoleCommand : CommandBase<ConsoleCommand> {
277 ConsoleCommand() = default;
278 ConsoleCommand(std::string cmd) : cmd(cmd) {}
279 std::string cmd;
281 };
282
294
295 using CommandType = boost::variant2::variant<
318
320
322 };
323
324} // namespace rpc
325} // namespace carla
MSGPACK_DEFINE_ARRAY(command)
CommandType command
Definition Command.h:319
boost::variant2::variant< SpawnActor, DestroyActor, ApplyVehicleControl, ApplyVehicleAckermannControl, ApplyWalkerControl, ApplyVehiclePhysicsControl, ApplyTransform, ApplyWalkerState, ApplyTargetVelocity, ApplyTargetAngularVelocity, ApplyImpulse, ApplyForce, ApplyAngularImpulse, ApplyTorque, SetSimulatePhysics, SetEnableGravity, SetAutopilot, ShowDebugTelemetry, SetVehicleLightState, ApplyLocation, ConsoleCommand, SetTrafficLightState > CommandType
Definition Command.h:295
uint32_t ActorId
Definition ActorId.h:14
This file contains definitions of common data structures used in traffic manager.
Definition Carla.cpp:133
ApplyAngularImpulse(ActorId id, const geom::Vector3D &value)
Definition Command.h:199
ApplyForce(ActorId id, const geom::Vector3D &value)
Definition Command.h:189
ApplyImpulse(ActorId id, const geom::Vector3D &value)
Definition Command.h:179
ApplyLocation(ActorId id, const geom::Location &value)
Definition Command.h:140
ApplyTargetAngularVelocity(ActorId id, const geom::Vector3D &value)
Definition Command.h:169
ApplyTargetVelocity(ActorId id, const geom::Vector3D &value)
Definition Command.h:159
ApplyTorque(ActorId id, const geom::Vector3D &value)
Definition Command.h:209
ApplyTransform(ActorId id, const geom::Transform &value)
Definition Command.h:130
MSGPACK_DEFINE_ARRAY(actor, transform)
ApplyVehicleAckermannControl(ActorId id, const VehicleAckermannControl &value)
Definition Command.h:100
ApplyVehicleControl(ActorId id, const VehicleControl &value)
Definition Command.h:90
ApplyVehiclePhysicsControl(ActorId id, const VehiclePhysicsControl &value)
Definition Command.h:120
ApplyWalkerControl(ActorId id, const WalkerControl &value)
Definition Command.h:110
ApplyWalkerState(ActorId id, const geom::Transform &value, const float speed)
Definition Command.h:150
MSGPACK_DEFINE_ARRAY(actor, transform, speed)
SetAutopilot(ActorId id, bool value, uint16_t tm_port)
Definition Command.h:239
SetEnableGravity(ActorId id, bool value)
Definition Command.h:229
SetSimulatePhysics(ActorId id, bool value)
Definition Command.h:219
MSGPACK_DEFINE_ARRAY(actor, traffic_light_state)
rpc::TrafficLightState traffic_light_state
Definition Command.h:291
SetTrafficLightState(ActorId id, rpc::TrafficLightState state)
Definition Command.h:285
VehicleLightState::flag_type light_state
Definition Command.h:272
SetVehicleLightState(ActorId id, VehicleLightState::flag_type value)
Definition Command.h:266
ShowDebugTelemetry(ActorId id, bool value)
Definition Command.h:254
MSGPACK_DEFINE_ARRAY(description, transform, parent, attachment_type, socket_name, do_after)
geom::Transform transform
Definition Command.h:72
SpawnActor(ActorDescription description, const geom::Transform &transform, ActorId parent)
Definition Command.h:61
AttachmentType attachment_type
Definition Command.h:74
ActorDescription description
Definition Command.h:71
SpawnActor(ActorDescription description, const geom::Transform &transform, ActorId parent, AttachmentType attachment_type, const std::string &bone)
Definition Command.h:65
SpawnActor(ActorDescription description, const geom::Transform &transform)
Definition Command.h:58
std::vector< Command > do_after
Definition Command.h:76
boost::optional< ActorId > parent
Definition Command.h:73