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"
12 #include "CarlaRecorderAnimBiker.h"
19 
20 #include <unordered_map>
21 
22 class UCarlaEpisode;
23 class FCarlaActor;
24 struct FActorDescription;
25 
27 {
28 
29 public:
30 
31  // set the episode to use
32  void SetEpisode(UCarlaEpisode *ThisEpisode)
33  {
34  Episode = ThisEpisode;
35  }
36 
37  // replay event for creating actor
38  std::pair<int, uint32_t> ProcessReplayerEventAdd(
39  FVector Location,
40  FVector Rotation,
42  uint32_t DesiredId,
43  bool bIgnoreHero,
44  bool bIgnoreSpectator,
45  bool ReplaySensors);
46 
47  // replay event for removing actor
48  bool ProcessReplayerEventDel(uint32_t DatabaseId);
49 
50  // replay event for parenting actors
51  bool ProcessReplayerEventParent(uint32_t ChildId, uint32_t ParentId);
52 
53  // reposition actors
54  bool ProcessReplayerPosition(CarlaRecorderPosition Pos1, CarlaRecorderPosition Pos2, double Per, double DeltaTime);
55 
56  // replay event for traffic light state
58 
59  // set the animation for Vehicles
61 
62  // set the animation for Vehicles Wheels
64 
65  // set the animation for walkers
67 
68  // set the animation for bikers
70 
71  // set the vehicle light
73 
74  // set scene lights
76 
77  // set walker bones
79 
80  // replay finish
81  bool ProcessReplayerFinish(bool bApplyAutopilot, bool bIgnoreHero, std::unordered_map<uint32_t, bool> &IsHero);
82 
83  // set the camera position to follow an actor
84  bool SetCameraPosition(uint32_t Id, FVector Offset, FQuat Rotation);
85 
86  // set the velocity of the actor
87  void SetActorVelocity(FCarlaActor *CarlaActor, FVector Velocity);
88 
89  // set the animation speed for walkers
90  void SetWalkerSpeed(uint32_t ActorId, float Speed);
91 
92  void RemoveStaticProps();
93 
94 private:
95 
96  UCarlaEpisode *Episode {nullptr};
97 
98  std::pair<int, FCarlaActor*>TryToCreateReplayerActor(
99  FVector &Location,
100  FVector &Rotation,
101  FActorDescription &ActorDesc,
102  uint32_t DesiredId,
103  bool SpawnSensors);
104 
105  FCarlaActor* FindTrafficLightAt(FVector Location);
106 
107  // enable / disable physics for an actor
108  bool SetActorSimulatePhysics(FCarlaActor *CarlaActor, bool bEnabled);
109  // enable / disable autopilot for an actor
110  bool SetActorAutopilot(FCarlaActor *CarlaActor, bool bEnabled, bool bKeepState = false);
111 };
void ProcessReplayerAnimBiker(CarlaRecorderAnimBiker Biker)
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)
void ProcessReplayerAnimVehicleWheels(CarlaRecorderAnimWheels Vehicle)
std::pair< int, uint32_t > ProcessReplayerEventAdd(FVector Location, FVector Rotation, CarlaRecorderActorDescription Description, uint32_t DesiredId, bool bIgnoreHero, bool bIgnoreSpectator, bool ReplaySensors)
void ProcessReplayerWalkerBones(const CarlaRecorderWalkerBones &Walker)
geom::Location Location
Definition: rpc/Location.h:14
void SetEpisode(UCarlaEpisode *ThisEpisode)
void ProcessReplayerLightScene(CarlaRecorderLightScene LightScene)
A simulation episode.
Definition: CarlaEpisode.h:38
bool ProcessReplayerFinish(bool bApplyAutopilot, bool bIgnoreHero, std::unordered_map< uint32_t, bool > &IsHero)
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)