CARLA
CarlaReplayerHelper.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 
10 #include "CarlaRecorderPosition.h"
11 #include "CarlaRecorderState.h"
16 
17 #include <unordered_map>
18 
19 class UCarlaEpisode;
20 class FCarlaActor;
21 struct FActorDescription;
22 
24 {
25 
26 public:
27 
28  // set the episode to use
29  void SetEpisode(UCarlaEpisode *ThisEpisode)
30  {
31  Episode = ThisEpisode;
32  }
33 
34  // replay event for creating actor
35  std::pair<int, uint32_t> ProcessReplayerEventAdd(
36  FVector Location,
37  FVector Rotation,
39  uint32_t DesiredId,
40  bool bIgnoreHero,
41  bool ReplaySensors);
42 
43  // replay event for removing actor
44  bool ProcessReplayerEventDel(uint32_t DatabaseId);
45 
46  // replay event for parenting actors
47  bool ProcessReplayerEventParent(uint32_t ChildId, uint32_t ParentId);
48 
49  // reposition actors
50  bool ProcessReplayerPosition(CarlaRecorderPosition Pos1, CarlaRecorderPosition Pos2, double Per, double DeltaTime);
51 
52  // replay event for traffic light state
54 
55  // set the animation for Vehicles
57 
58  // set the animation for walkers
60 
61  // set the vehicle light
63 
64  // set scene lights
66 
67  // replay finish
68  bool ProcessReplayerFinish(bool bApplyAutopilot, bool bIgnoreHero, std::unordered_map<uint32_t, bool> &IsHero);
69 
70  // set the camera position to follow an actor
71  bool SetCameraPosition(uint32_t Id, FVector Offset, FQuat Rotation);
72 
73  // set the velocity of the actor
74  void SetActorVelocity(FCarlaActor *CarlaActor, FVector Velocity);
75 
76  // set the animation speed for walkers
77  void SetWalkerSpeed(uint32_t ActorId, float Speed);
78 
79  void RemoveStaticProps();
80 
81 private:
82 
83  UCarlaEpisode *Episode {nullptr};
84 
85  std::pair<int, FCarlaActor*>TryToCreateReplayerActor(
86  FVector &Location,
87  FVector &Rotation,
88  FActorDescription &ActorDesc,
89  uint32_t DesiredId,
90  bool SpawnSensors);
91 
92  FCarlaActor* FindTrafficLightAt(FVector Location);
93 
94  // enable / disable physics for an actor
95  bool SetActorSimulatePhysics(FCarlaActor *CarlaActor, bool bEnabled);
96  // enable / disable autopilot for an actor
97  bool SetActorAutopilot(FCarlaActor *CarlaActor, bool bEnabled, bool bKeepState = false);
98 };
FCarlaActor * FindTrafficLightAt(FVector Location)
void SetActorVelocity(FCarlaActor *CarlaActor, FVector Velocity)
void ProcessReplayerLightVehicle(CarlaRecorderLightVehicle LightVehicle)
void ProcessReplayerAnimVehicle(CarlaRecorderAnimVehicle Vehicle)
bool SetActorSimulatePhysics(FCarlaActor *CarlaActor, bool bEnabled)
void SetWalkerSpeed(uint32_t ActorId, float Speed)
bool ProcessReplayerStateTrafficLight(CarlaRecorderStateTrafficLight State)
bool SetActorAutopilot(FCarlaActor *CarlaActor, bool bEnabled, bool bKeepState=false)
geom::Location Location
Definition: rpc/Location.h:14
void SetEpisode(UCarlaEpisode *ThisEpisode)
void ProcessReplayerLightScene(CarlaRecorderLightScene LightScene)
A simulation episode.
Definition: CarlaEpisode.h:34
bool ProcessReplayerFinish(bool bApplyAutopilot, bool bIgnoreHero, std::unordered_map< uint32_t, bool > &IsHero)
std::pair< int, uint32_t > ProcessReplayerEventAdd(FVector Location, FVector Rotation, CarlaRecorderActorDescription Description, uint32_t DesiredId, bool bIgnoreHero, bool ReplaySensors)
bool ProcessReplayerPosition(CarlaRecorderPosition Pos1, CarlaRecorderPosition Pos2, double Per, double DeltaTime)
A description of a Carla Actor with all its variation.
uint32_t ActorId
Definition: ActorId.h:14
bool ProcessReplayerEventParent(uint32_t ChildId, uint32_t ParentId)
geom::Rotation Rotation
Definition: rpc/Transform.h:14
UCarlaEpisode * Episode
bool ProcessReplayerEventDel(uint32_t DatabaseId)
std::pair< int, FCarlaActor * > TryToCreateReplayerActor(FVector &Location, FVector &Rotation, FActorDescription &ActorDesc, uint32_t DesiredId, bool SpawnSensors)
bool SetCameraPosition(uint32_t Id, FVector Offset, FQuat Rotation)
A view over an actor and its properties.
Definition: CarlaActor.h:23
void ProcessReplayerAnimWalker(CarlaRecorderAnimWalker Walker)