CARLA
Loading...
Searching...
No Matches
CarlaReplayerHelper.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
11#include "CarlaRecorderState.h"
21
22#include <unordered_map>
23
24class UCarlaEpisode;
25class FCarlaActor;
27
29{
30
31public:
32
33 // set the episode to use
34 void SetEpisode(UCarlaEpisode *ThisEpisode)
35 {
36 Episode = ThisEpisode;
37 }
38
39 // replay event for creating actor
40 std::pair<int, uint32_t> ProcessReplayerEventAdd(
41 FVector Location,
42 FVector Rotation,
44 uint32_t DesiredId,
45 bool bIgnoreHero,
46 bool bIgnoreSpectator,
47 bool ReplaySensors);
48
49 // replay event for removing actor
50 bool ProcessReplayerEventDel(uint32_t DatabaseId);
51
52 // replay event for parenting actors
53 bool ProcessReplayerEventParent(uint32_t ChildId, uint32_t ParentId);
54
55 // reposition actors
56 bool ProcessReplayerPosition(CarlaRecorderPosition Pos1, CarlaRecorderPosition Pos2, double Per, double DeltaTime);
57
58 // replay event for traffic light state
60
61 // set the animation for Vehicles
63
64 // set the animation for Vehicles Wheels, interpolating like the positions;
65 // Travel is how far the vehicle moves forward from Wheels1 to Wheels2, in cm
67 const CarlaRecorderAnimWheels &Wheels1,
68 const CarlaRecorderAnimWheels &Wheels2,
69 double Per,
70 float Travel);
71
72 // set the animation for walkers
74
75 // set the openings and closing of vehicle doors
77
78 // set the animation for bikers
80
81 // set the vehicle light
83
84 // set scene lights
86
87 // set walker bones
89
90 // set weather
92
93 // replay finish
94 bool ProcessReplayerFinish(bool bApplyAutopilot, bool bIgnoreHero, std::unordered_map<uint32_t, bool> &IsHero);
95
96 // set the camera position to follow an actor
97 bool SetCameraPosition(uint32_t Id, FVector Offset, FQuat Rotation);
98
99 // set the velocity of the actor
100 void SetActorVelocity(FCarlaActor *CarlaActor, FVector Velocity);
101
102 // set the animation speed for walkers
103 void SetWalkerSpeed(uint32_t ActorId, float Speed);
104
105 void RemoveStaticProps();
106
107private:
108
110
111 std::pair<int, FCarlaActor*>TryToCreateReplayerActor(
112 FVector &Location,
113 FVector &Rotation,
114 FActorDescription &ActorDesc,
115 uint32_t DesiredId,
116 bool SpawnSensors);
117
118 FCarlaActor* FindTrafficSignAt(FVector Location);
119
120 // enable / disable physics for an actor
121 bool SetActorSimulatePhysics(FCarlaActor *CarlaActor, bool bEnabled);
122 // enable / disable autopilot for an actor
123 bool SetActorAutopilot(FCarlaActor *CarlaActor, bool bEnabled, bool bKeepState = false);
124};
void SetWalkerSpeed(uint32_t ActorId, float Speed)
std::pair< int, FCarlaActor * > TryToCreateReplayerActor(FVector &Location, FVector &Rotation, FActorDescription &ActorDesc, uint32_t DesiredId, bool SpawnSensors)
void ProcessReplayerWalkerBones(const CarlaRecorderWalkerBones &Walker)
bool ProcessReplayerFinish(bool bApplyAutopilot, bool bIgnoreHero, std::unordered_map< uint32_t, bool > &IsHero)
void SetActorVelocity(FCarlaActor *CarlaActor, FVector Velocity)
void ProcessReplayerAnimVehicleWheels(const CarlaRecorderAnimWheels &Wheels1, const CarlaRecorderAnimWheels &Wheels2, double Per, float Travel)
void ProcessReplayerLightScene(CarlaRecorderLightScene LightScene)
FCarlaActor * FindTrafficSignAt(FVector Location)
void ProcessReplayerDoorVehicle(CarlaRecorderDoorVehicle DoorVehicle)
void ProcessReplayerAnimWalker(CarlaRecorderAnimWalker Walker)
void SetEpisode(UCarlaEpisode *ThisEpisode)
bool ProcessReplayerStateTrafficLight(CarlaRecorderStateTrafficLight State)
bool ProcessReplayerEventParent(uint32_t ChildId, uint32_t ParentId)
bool SetActorSimulatePhysics(FCarlaActor *CarlaActor, bool bEnabled)
void ProcessReplayerAnimVehicle(CarlaRecorderAnimVehicle Vehicle)
bool SetActorAutopilot(FCarlaActor *CarlaActor, bool bEnabled, bool bKeepState=false)
bool ProcessReplayerEventDel(uint32_t DatabaseId)
void ProcessReplayerLightVehicle(CarlaRecorderLightVehicle LightVehicle)
std::pair< int, uint32_t > ProcessReplayerEventAdd(FVector Location, FVector Rotation, CarlaRecorderActorDescription Description, uint32_t DesiredId, bool bIgnoreHero, bool bIgnoreSpectator, bool ReplaySensors)
void ProcessReplayerAnimBiker(CarlaRecorderAnimBiker Biker)
bool ProcessReplayerPosition(CarlaRecorderPosition Pos1, CarlaRecorderPosition Pos2, double Per, double DeltaTime)
void ProcessReplayerWeather(const CarlaRecorderWeather &Weather)
bool SetCameraPosition(uint32_t Id, FVector Offset, FQuat Rotation)
A view over an actor and its properties.
Definition CarlaActor.h:25
A simulation episode.
A description of a Carla Actor with all its variation.