CARLA
CarlaRecorder.cpp
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 #include "Carla.h"
19 #include "Components/BoxComponent.h"
20 #include "Components/SkeletalMeshComponent.h"
21 #include "VehicleAnimInstance.h"
22 
26 
27 #include "CarlaRecorder.h"
28 #include "CarlaReplayerHelper.h"
29 
30 #include <ctime>
31 #include <sstream>
32 
34 {
35  PrimaryActorTick.TickGroup = TG_PrePhysics;
36  Disable();
37 }
38 
39 ACarlaRecorder::ACarlaRecorder(const FObjectInitializer &ObjectInitializer)
40  : Super(ObjectInitializer)
41 {
42  PrimaryActorTick.TickGroup = TG_PrePhysics;
43  Disable();
44 }
45 
46 std::string ACarlaRecorder::ShowFileInfo(std::string Name, bool bShowAll)
47 {
48  return Query.QueryInfo(Name, bShowAll);
49 }
50 
51 std::string ACarlaRecorder::ShowFileCollisions(std::string Name, char Type1, char Type2)
52 {
53  return Query.QueryCollisions(Name, Type1, Type2);
54 }
55 
56 std::string ACarlaRecorder::ShowFileActorsBlocked(std::string Name, double MinTime, double MinDistance)
57 {
58  return Query.QueryBlocked(Name, MinTime, MinDistance);
59 }
60 
61 std::string ACarlaRecorder::ReplayFile(std::string Name, double TimeStart, double Duration,
62  uint32_t FollowId, bool ReplaySensors)
63 {
64  Stop();
65  return Replayer.ReplayFile(Name, TimeStart, Duration, FollowId, ReplaySensors);
66 }
67 
69 {
70  Replayer.SetTimeFactor(TimeFactor);
71 }
72 
74 {
75  Replayer.SetIgnoreHero(IgnoreHero);
76 }
77 
79 {
80  Replayer.SetIgnoreSpectator(IgnoreSpectator);
81 }
82 
83 void ACarlaRecorder::StopReplayer(bool KeepActors)
84 {
85  Replayer.Stop(KeepActors);
86 }
87 
88 void ACarlaRecorder::Ticking(float DeltaSeconds)
89 {
90  TRACE_CPUPROFILER_EVENT_SCOPE(ACarlaRecorder::Ticking);
91  Super::Tick(DeltaSeconds);
92 
93  if (!Episode)
94  return;
95 
96  // check if recording
97  if (Enabled)
98  {
101 
102  const FActorRegistry &Registry = Episode->GetActorRegistry();
103 
104  // through all actors in registry
105  for (auto It = Registry.begin(); It != Registry.end(); ++It)
106  {
107  FCarlaActor* View = It.Value().Get();
108 
109  switch (View->GetActorType())
110  {
111  // save the transform for props
113  AddActorPosition(View);
114  break;
115 
116  // save the transform of all vehicles
118  AddActorPosition(View);
119  AddVehicleAnimation(View);
120  AddVehicleLight(View);
122  if (bAdditionalData)
123  {
124  AddActorKinematics(View);
125  }
126  break;
127 
128  // save the transform of all walkers
130  AddActorPosition(View);
131  AddWalkerAnimation(View);
132  if (bAdditionalData)
133  {
134  AddActorKinematics(View);
135  AddActorBones(View);
136  }
137  break;
138 
139  // save the state of each traffic light
141  AddTrafficLightState(View);
142  break;
143  }
144  }
145 
146  // write all data for this frame
147  Write(DeltaSeconds);
148  }
149  else if (Episode->GetReplayer()->IsEnabled())
150  {
151  // replayer
152  Episode->GetReplayer()->Tick(DeltaSeconds);
153  }
154 }
155 
157 {
158  PrimaryActorTick.bCanEverTick = true;
159  Enabled = true;
160 }
161 
163 {
164  PrimaryActorTick.bCanEverTick = false;
165  Enabled = false;
166 }
167 
169 {
170  check(CarlaActor != nullptr);
171 
172  FTransform Transform = CarlaActor->GetActorGlobalTransform();
173  // get position of the vehicle
175  {
176  CarlaActor->GetActorId(),
177  Transform.GetLocation(),
178  Transform.GetRotation().Euler()
179  });
180 }
181 
183 {
184  check(CarlaActor != nullptr);
185 
186  if (CarlaActor->IsPendingKill())
187  {
188  return;
189  }
190 
191  FVehicleControl Control;
192  CarlaActor->GetVehicleControl(Control);
193 
194  // save
196  Record.DatabaseId = CarlaActor->GetActorId();
197  Record.Steering = Control.Steer;
198  Record.Throttle = Control.Throttle;
199  Record.Brake = Control.Brake;
200  Record.bHandbrake = Control.bHandBrake;
201  Record.Gear = Control.Gear;
202  AddAnimVehicle(Record);
203 }
204 
206 {
207  check(CarlaActor != nullptr)
208  if (CarlaActor->IsPendingKill())
209  return;
210  if (CarlaActor->GetActorType() != FCarlaActor::ActorType::Vehicle)
211  return;
212 
213  ACarlaWheeledVehicle* CarlaVehicle = Cast<ACarlaWheeledVehicle>(CarlaActor->GetActor());
214  if (CarlaVehicle == nullptr)
215  return;
216 
217  USkeletalMeshComponent* SkeletalMesh = CarlaVehicle->GetMesh();
218  if (SkeletalMesh == nullptr)
219  return;
220 
221  UVehicleAnimInstance* VehicleAnim = Cast<UVehicleAnimInstance>(SkeletalMesh->GetAnimInstance());
222  if (VehicleAnim == nullptr)
223  return;
224 
225  const UWheeledVehicleMovementComponent* WheeledVehicleMovementComponent = VehicleAnim->GetWheeledVehicleMovementComponent();
226  if (WheeledVehicleMovementComponent == nullptr)
227  return;
228 
230  Record.DatabaseId = CarlaActor->GetActorId();
231  Record.WheelValues.reserve(WheeledVehicleMovementComponent->Wheels.Num());
232 
233  uint8 i = 0;
234  for (auto Wheel : WheeledVehicleMovementComponent->Wheels)
235  {
236  WheelInfo Info;
237  Info.Location = static_cast<EVehicleWheelLocation>(i);
238  Info.SteeringAngle = CarlaVehicle->GetWheelSteerAngle(Info.Location);
239  Info.TireRotation = Wheel->GetRotationAngle();
240  Record.WheelValues.push_back(Info);
241  ++i;
242  }
243 
244  AddAnimVehicleWheels(Record);
245 
246  if (CarlaVehicle->IsTwoWheeledVehicle())
247  {
249  {
250  CarlaActor->GetActorId(),
251  WheeledVehicleMovementComponent->GetForwardSpeed(),
252  WheeledVehicleMovementComponent->GetEngineRotationSpeed() / WheeledVehicleMovementComponent->GetEngineMaxRotationSpeed()
253  });
254  }
255 }
256 
258 {
259  check(CarlaActor != nullptr);
260 
261  if (!CarlaActor->IsPendingKill())
262  {
263  FWalkerControl Control;
264  CarlaActor->GetWalkerControl(Control);
266  {
267  CarlaActor->GetActorId(),
268  Control.Speed
269  });
270  }
271 }
272 
274 {
275  check(CarlaActor != nullptr);
276 
277  ETrafficLightState LightState = CarlaActor->GetTrafficLightState();
278  UTrafficLightController* Controller = CarlaActor->GetTrafficLightController();
279  if (Controller)
280  {
281  ATrafficLightGroup* Group = Controller->GetGroup();
282  if (Group)
283  {
285  {
286  CarlaActor->GetActorId(),
287  Group->IsFrozen(),
288  Controller->GetElapsedTime(),
289  static_cast<char>(LightState)
290  });
291  }
292  }
293 }
294 
296 {
297  check(CarlaActor != nullptr);
298 
299  FVehicleLightState LightState;
300  CarlaActor->GetVehicleLightState(LightState);
301  CarlaRecorderLightVehicle LightVehicle;
302  LightVehicle.DatabaseId = CarlaActor->GetActorId();
303  LightVehicle.State = carla::rpc::VehicleLightState(LightState).light_state;
304  AddLightVehicle(LightVehicle);
305 }
306 
308 {
309  check(CarlaActor != nullptr);
310 
311  FVector Velocity, AngularVelocity;
312  constexpr float TO_METERS = 1e-2;
313  Velocity = TO_METERS* CarlaActor->GetActorVelocity();
314  AngularVelocity = CarlaActor->GetActorAngularVelocity();
315  CarlaRecorderKinematics Kinematic =
316  {
317  CarlaActor->GetActorId(),
318  Velocity,
319  AngularVelocity
320  };
321  AddKinematics(Kinematic);
322 }
323 
325 {
326  check(CarlaActor != nullptr);
327 
328  const auto &Box = CarlaActor->GetActorInfo()->BoundingBox;
330  {
331  CarlaActor->GetActorId(),
332  {Box.Origin, Box.Extent}
333  };
334 
335  AddBoundingBox(BoundingBox);
336 }
337 
339 {
340  if (bAdditionalData)
341  {
342  TArray<UBoxComponent*> Triggers = TrafficSign.GetTriggerVolumes();
343  if(!Triggers.Num())
344  {
345  return;
346  }
347  UBoxComponent* Trigger = Triggers.Top();
348  auto VolumeOrigin = Trigger->GetComponentLocation();
349  auto VolumeExtent = Trigger->GetScaledBoxExtent();
351  {
353  {VolumeOrigin, VolumeExtent}
354  };
355  TriggerVolumes.Add(TriggerVolume);
356  }
357 }
358 
360 {
361  if (bAdditionalData)
362  {
364  Control.DatabaseId = Episode->GetActorRegistry().FindCarlaActor(&Vehicle)->GetActorId();
366  PhysicsControls.Add(Control);
367  }
368 }
369 
371 {
372  if (bAdditionalData)
373  {
374  auto DatabaseId = Episode->GetActorRegistry().FindCarlaActor(&TrafficLight)->GetActorId();
376  DatabaseId,
377  TrafficLight.GetGreenTime(),
378  TrafficLight.GetYellowTime(),
379  TrafficLight.GetRedTime()
380  };
382  }
383 }
384 
386 {
387  check(CarlaActor != nullptr);
388 
389  // get the bones
390  FWalkerBoneControlOut Bones;
391  CarlaActor->GetBonesTransform(Bones);
392 
394  Walker.DatabaseId = CarlaActor->GetActorId();
395  for (auto &Bone : Bones.BoneTransforms)
396  {
397  FString Name = Bone.Get<0>();
398  auto Transforms = Bone.Get<1>();
399  FVector Loc = Transforms.Relative.GetTranslation();
400  FVector Rot = Transforms.Relative.GetRotation().Euler();
401  CarlaRecorderWalkerBone Entry(Name, Loc, Rot);
402  Walker.Bones.push_back(Entry);
403  }
404  WalkersBones.Add(std::move(Walker));
405 }
406 
407 std::string ACarlaRecorder::Start(std::string Name, FString MapName, bool AdditionalData)
408 {
409  // stop replayer if any in course
410  if (Replayer.IsEnabled())
411  Replayer.Stop();
412 
413  // stop recording
414  Stop();
415 
416  // reset collisions Id
417  NextCollisionId = 0;
418 
419  // get the final path + filename
420  std::string Filename = GetRecorderFilename(Name);
421 
422  // binary file
423  File.open(Filename, std::ios::binary);
424  if (!File.is_open())
425  {
426  return "";
427  }
428 
429  // save info
430  Info.Version = 1;
431  Info.Magic = TEXT("CARLA_RECORDER");
432  Info.Date = std::time(0);
433  Info.Mapfile = MapName;
434 
435  // write general info
436  Info.Write(File);
437 
438  Frames.Reset();
440 
441  Enable();
442 
443  bAdditionalData = AdditionalData;
444 
445  // add all existing actors
447 
448  return std::string(Filename);
449 }
450 
452 {
453  Disable();
454 
455  if (File)
456  {
457  File.close();
458  }
459 
460  Clear();
461 }
462 
464 {
465  EventsAdd.Clear();
466  EventsDel.Clear();
468  Collisions.Clear();
469  Positions.Clear();
470  States.Clear();
471  Vehicles.Clear();
472  Walkers.Clear();
474  LightScenes.Clear();
475  Kinematics.Clear();
481  Wheels.Clear();
482  Bikers.Clear();
483 }
484 
485 void ACarlaRecorder::Write(double DeltaSeconds)
486 {
487  // update this frame data
488  Frames.SetFrame(DeltaSeconds);
489 
490  // start
493 
494  // events
499 
500  // positions and states
502  States.Write(File);
503 
504  // animations
506  Walkers.Write(File);
509  Wheels.Write(File);
510  Bikers.Write(File);
511 
512  // additional info
513  if (bAdditionalData)
514  {
522  }
523 
524  // end
526 
527  Clear();
528 }
529 
531 {
532  if (Enabled)
533  {
534  Positions.Add(Position);
535  }
536 }
537 
539 {
540  if (Enabled)
541  {
542  EventsAdd.Add(std::move(Event));
543  }
544 }
545 
547 {
548  if (Enabled)
549  {
550  EventsDel.Add(std::move(Event));
551  }
552 }
553 
555 {
556  if (Enabled)
557  {
558  EventsParent.Add(std::move(Event));
559  }
560 }
561 
563 {
564  if (Enabled)
565  {
567 
568  // some inits
569  Collision.Id = NextCollisionId++;
570  Collision.IsActor1Hero = false;
571  Collision.IsActor2Hero = false;
572 
573  // check actor 1
574  FCarlaActor *FoundActor1 = Episode->GetActorRegistry().FindCarlaActor(Actor1);
575  if (FoundActor1 != nullptr) {
576  if (FoundActor1->GetActorInfo() != nullptr)
577  {
578  auto Role = FoundActor1->GetActorInfo()->Description.Variations.Find("role_name");
579  if (Role != nullptr)
580  Collision.IsActor1Hero = (Role->Value == "hero");
581  }
582  Collision.DatabaseId1 = FoundActor1->GetActorId();
583  }
584  else {
585  Collision.DatabaseId1 = uint32_t(-1); // actor1 is not a registered Carla actor
586  }
587 
588  // check actor 2
589  FCarlaActor *FoundActor2 = Episode->GetActorRegistry().FindCarlaActor(Actor2);
590  if (FoundActor2 != nullptr) {
591  if (FoundActor2->GetActorInfo() != nullptr)
592  {
593  auto Role = FoundActor2->GetActorInfo()->Description.Variations.Find("role_name");
594  if (Role != nullptr)
595  Collision.IsActor2Hero = (Role->Value == "hero");
596  }
597  Collision.DatabaseId2 = FoundActor2->GetActorId();
598  }
599  else {
600  Collision.DatabaseId2 = uint32_t(-1); // actor2 is not a registered Carla actor
601  }
602 
603  Collisions.Add(std::move(Collision));
604  }
605 }
606 
608 {
609  if (Enabled)
610  {
611  States.Add(State);
612  }
613 }
614 
616 {
617  if (Enabled)
618  {
619  Vehicles.Add(Vehicle);
620  }
621 }
622 
624 {
625  if (Enabled)
626  {
627  Wheels.Add(VehicleWheels);
628  }
629 }
630 
632 {
633  if (Enabled)
634  {
635  Walkers.Add(Walker);
636  }
637 }
638 
640 {
641  if (Enabled)
642  {
643  Bikers.Add(Biker);
644  }
645 }
646 
648 {
649  if (Enabled)
650  {
651  LightVehicles.Add(LightVehicle);
652  }
653 }
654 
655 void ACarlaRecorder::AddEventLightSceneChanged(const UCarlaLight* Light)
656 {
657  if (Enabled)
658  {
659  CarlaRecorderLightScene LightScene =
660  {
661  Light->GetId(),
662  Light->GetLightIntensity(),
663  Light->GetLightColor(),
664  Light->GetLightOn(),
665  static_cast<uint8>(Light->GetLightType())
666  };
667 
668  LightScenes.Add(LightScene);
669  }
670 }
671 
673 {
674  if (Enabled)
675  {
676  Kinematics.Add(ActorKinematics);
677  }
678 }
679 
681 {
682  if (Enabled)
683  {
684  BoundingBoxes.Add(ActorBoundingBox);
685  }
686 }
687 
689 {
690  // registring all existing actors in first frame
692  for (auto& It : Registry)
693  {
694  const FCarlaActor* CarlaActor = It.Value.Get();
695  if (CarlaActor != nullptr)
696  {
697  // create event
699  CarlaActor->GetActorId(),
700  static_cast<uint8_t>(CarlaActor->GetActorType()),
701  CarlaActor->GetActorGlobalTransform(),
702  CarlaActor->GetActorInfo()->Description);
703  }
704  }
705 
706  UWorld *World = GetWorld();
707  if(World)
708  {
709  UCarlaLightSubsystem* CarlaLightSubsystem = World->GetSubsystem<UCarlaLightSubsystem>();
710  const auto& Lights = CarlaLightSubsystem->GetLights();
711  for (const auto& LightPair : Lights)
712  {
713  UCarlaLight* Light = LightPair.Value;
715  }
716  }
717 
718 }
719 
721  uint32_t DatabaseId,
722  uint8_t Type,
723  const FTransform &Transform,
724  FActorDescription ActorDescription)
725 {
726  CarlaRecorderActorDescription Description;
727  Description.UId = ActorDescription.UId;
728  Description.Id = ActorDescription.Id;
729 
730  // attributes
731  Description.Attributes.reserve(ActorDescription.Variations.Num());
732  for (const auto &item : ActorDescription.Variations)
733  {
735  Attr.Type = static_cast<uint8_t>(item.Value.Type);
736  Attr.Id = item.Value.Id;
737  Attr.Value = item.Value.Value;
738  // check for empty attributes
739  if (!Attr.Id.IsEmpty())
740  {
741  Description.Attributes.emplace_back(std::move(Attr));
742  }
743  }
744 
745  // recorder event
746  CarlaRecorderEventAdd RecEvent
747  {
748  DatabaseId,
749  Type,
750  Transform.GetTranslation(),
751  Transform.GetRotation().Euler(),
752  std::move(Description)
753  };
754  AddEvent(std::move(RecEvent));
755 
756  FCarlaActor* CarlaActor = Episode->FindCarlaActor(DatabaseId);
757  // Other events related to spawning actors
758  // check if it is a vehicle to get initial physics control
759  ACarlaWheeledVehicle* Vehicle = Cast<ACarlaWheeledVehicle>(CarlaActor->GetActor());
760  if (Vehicle)
761  {
762  AddPhysicsControl(*Vehicle);
763  }
764 
765  ATrafficLightBase* TrafficLight = Cast<ATrafficLightBase>(CarlaActor->GetActor());
766  if (TrafficLight)
767  {
768  AddTrafficLightTime(*TrafficLight);
769  }
770 
771  ATrafficSignBase* TrafficSign = Cast<ATrafficSignBase>(CarlaActor->GetActor());
772  if (TrafficSign)
773  {
774  // Trigger volume in global coordinates
775  AddTriggerVolume(*TrafficSign);
776  }
777  else
778  {
779  // Bounding box in local coordinates
780  AddActorBoundingBox(CarlaActor);
781  }
782 }
void AddEventLightSceneChanged(const UCarlaLight *Light)
FCarlaActor * FindCarlaActor(FCarlaActor::IdType ActorId)
Find a Carla actor by id.
Definition: CarlaEpisode.h:173
CarlaReplayer * GetReplayer() const
Definition: CarlaEpisode.h:315
CarlaRecorderTrafficLightTimes TrafficLightTimes
CarlaRecorderFrames Frames
CarlaRecorderQuery Query
bool IsEnabled(void)
Definition: CarlaReplayer.h:65
void Add(const CarlaRecorderAnimVehicle &InObj)
CarlaRecorderAnimVehicles Vehicles
auto end() const noexcept
std::vector< carla::rpc::LightState > GetLights(FString Client)
CarlaRecorderInfo Info
void Add(const CarlaRecorderAnimBiker &InObj)
void SetTimeFactor(double NewTimeFactor)
Definition: CarlaReplayer.h:78
void StopReplayer(bool KeepActors=false)
A registry of all the Carla actors.
Definition: ActorRegistry.h:20
CarlaRecorderPlatformTime PlatformTime
void Add(const CarlaRecorderPosition &InObj)
void AddAnimBiker(const CarlaRecorderAnimBiker &Biker)
std::string Start(std::string Name, FString MapName, bool AdditionalData=false)
void Write(std::ostream &OutFile)
FVehiclePhysicsControl GetVehiclePhysicsControl() const
CarlaRecorderAnimVehicleWheels Wheels
TArray< UBoxComponent * > GetTriggerVolumes() const
FVector GetActorAngularVelocity() const
Definition: CarlaActor.cpp:372
virtual ETrafficLightState GetTrafficLightState() const
Definition: CarlaActor.h:353
std::string ShowFileCollisions(std::string Name, char Type1, char Type2)
virtual ECarlaServerResponse GetWalkerControl(FWalkerControl &)
Definition: CarlaActor.h:393
void Write(std::ostream &OutFile)
CarlaReplayer Replayer
AActor * GetActor()
Definition: CarlaActor.h:90
CarlaRecorderLightScenes LightScenes
void Add(const CarlaRecorderCollision &Collision)
void AddAnimVehicle(const CarlaRecorderAnimVehicle &Vehicle)
void Add(const CarlaRecorderAnimWheels &InObj)
CarlaRecorderAnimWalkers Walkers
void Add(const CarlaRecorderLightScene &InObj)
void Add(const CarlaRecorderTrafficLightTime &InObj)
void AddBoundingBox(const CarlaRecorderActorBoundingBox &ActorBoundingBox)
auto begin() const noexcept
void SetIgnoreHero(bool InIgnoreHero)
Definition: CarlaReplayer.h:84
void SetReplayerTimeFactor(double TimeFactor)
void AddAnimWalker(const CarlaRecorderAnimWalker &Walker)
void Write(std::ofstream &OutFile)
void AddActorBoundingBox(FCarlaActor *CarlaActor)
Class which implements the state changing of traffic lights.
std::string ShowFileActorsBlocked(std::string Name, double MinTime=30, double MinDistance=10)
void Write(std::ostream &File)
float GetGreenTime() const
void Add(const CarlaRecorderEventAdd &Event)
void AddVehicleLight(FCarlaActor *CarlaActor)
void AddEvent(const CarlaRecorderEventAdd &Event)
void Add(const CarlaRecorderStateTrafficLight &State)
void AddWalkerAnimation(FCarlaActor *CarlaActor)
std::string QueryBlocked(std::string Filename, double MinTime=30, double MinDistance=10)
CarlaRecorderVisualTime VisualTime
void AddVehicleWheelsAnimation(FCarlaActor *CarlaActor)
EVehicleWheelLocation Location
CarlaRecorderWalkersBones WalkersBones
void Write(std::ostream &OutFile)
CarlaRecorderActorBoundingBoxes BoundingBoxes
bg::model::box< Point3D > Box
Definition: InMemoryMap.h:52
void AddKinematics(const CarlaRecorderKinematics &ActorKinematics)
void Clear(void)
void AddActorKinematics(FCarlaActor *CarlaActor)
void AddTrafficLightTime(const ATrafficLightBase &TrafficLight)
CarlaRecorderPhysicsControls PhysicsControls
CarlaRecorderLightVehicles LightVehicles
void Add(const CarlaRecorderPhysicsControl &InObj)
std::string QueryCollisions(std::string Filename, char Category1='a', char Category2='a')
CarlaRecorderAnimBikers Bikers
void Add(const CarlaRecorderLightVehicle &InObj)
void Write(std::ostream &OutFile)
void AddCollision(AActor *Actor1, AActor *Actor2)
const FActorRegistry & GetActorRegistry() const
Definition: CarlaEpisode.h:155
void CreateRecorderEventAdd(uint32_t DatabaseId, uint8_t Type, const FTransform &Transform, FActorDescription ActorDescription)
TMap< FString, FActorAttribute > Variations
User selected variations of the actor.
CarlaRecorderEventsParent EventsParent
void Add(const CarlaRecorderActorBoundingBox &InObj)
void Add(const CarlaRecorderKinematics &InObj)
void Write(std::ostream &OutFile)
std::string ReplayFile(std::string Name, double TimeStart, double Duration, uint32_t FollowId, bool ReplaySensors)
void AddActorBones(FCarlaActor *CarlaActor)
void Write(std::ostream &OutFile)
void Write(std::ostream &OutFile)
UCarlaEpisode * Episode
std::ofstream File
std::string QueryInfo(std::string Filename, bool bShowAll=false)
virtual ECarlaServerResponse GetBonesTransform(FWalkerBoneControlOut &)
Definition: CarlaActor.h:398
void SetFrame(double DeltaSeconds)
std::vector< CarlaRecorderActorAttribute > Attributes
CarlaRecorderEventsAdd EventsAdd
CarlaRecorderCollisions Collisions
void Write(std::ofstream &OutFile)
void AddPosition(const CarlaRecorderPosition &Position)
float GetWheelSteerAngle(EVehicleWheelLocation WheelLocation)
A description of a Carla Actor with all its variation.
FVector GetActorVelocity() const
Definition: CarlaActor.cpp:360
FActorDescription Description
Definition: ActorInfo.h:26
void SetReplayerIgnoreHero(bool IgnoreHero)
void Write(std::ostream &OutFile)
const FActorInfo * GetActorInfo() const
Definition: CarlaActor.h:100
void AddTrafficLightState(FCarlaActor *CarlaActor)
FBoundingBox BoundingBox
Definition: ActorInfo.h:30
void Add(const CarlaRecorderWalkerBones &InObj)
bool IsPendingKill() const
Definition: CarlaActor.h:75
float GetRedTime() const
void AddExistingActors(void)
void Ticking(float DeltaSeconds)
float GetYellowTime() const
std::string ReplayFile(std::string Filename, double TimeStart=0.0f, double Duration=0.0f, uint32_t FollowId=0, bool ReplaySensors=false)
void SetReplayerIgnoreSpectator(bool IgnoreSpectator)
EVehicleWheelLocation
uint32_t NextCollisionId
CarlaRecorderActorsKinematics Kinematics
void WriteStart(std::ostream &OutFile)
void AddVehicleAnimation(FCarlaActor *CarlaActor)
void Write(std::ostream &OutFile)
virtual UTrafficLightController * GetTrafficLightController()
Definition: CarlaActor.h:358
std::string ShowFileInfo(std::string Name, bool bShowAll=false)
CarlaRecorderPositions Positions
void WriteEnd(std::ostream &OutFile)
FTransform GetActorGlobalTransform() const
Definition: CarlaActor.cpp:199
void Tick(float Time)
uint32 UId
UId of the definition in which this description was based.
CarlaRecorderActorTriggerVolumes TriggerVolumes
std::string GetRecorderFilename(std::string Filename)
CarlaRecorderEventsDel EventsDel
void Enable(void)
virtual ECarlaServerResponse GetVehicleLightState(FVehicleLightState &)
Definition: CarlaActor.h:253
virtual ECarlaServerResponse GetVehicleControl(FVehicleControl &)
Definition: CarlaActor.h:300
void Stop(bool KeepActors=false)
IdType GetActorId() const
Definition: CarlaActor.h:80
void Add(const CarlaRecorderEventParent &Event)
void Add(const CarlaRecorderAnimWalker &InObj)
FCarlaActor * FindCarlaActor(IdType Id)
Definition: ActorRegistry.h:69
void Disable(void)
void AddAnimVehicleWheels(const CarlaRecorderAnimWheels &VehicleWheels)
void AddActorPosition(FCarlaActor *CarlaActor)
void AddLightVehicle(const CarlaRecorderLightVehicle &LightVehicle)
ATrafficLightGroup * GetGroup()
std::vector< WheelInfo > WheelValues
void Add(const CarlaRecorderActorBoundingBox &InObj)
void Add(const CarlaRecorderEventDel &Event)
flag_type light_state
Lights state flag, all turned off by default.
Base class for CARLA wheeled vehicles.
Maps a controller from OpenDrive.
void Write(std::ostream &OutFile)
Defines the physical appearance of a vehicle whitch is obtained by the sensors.
void Write(std::ostream &OutFile)
void SetIgnoreSpectator(bool InIgnoreSpectator)
Definition: CarlaReplayer.h:90
CarlaRecorderStates States
void AddPhysicsControl(const ACarlaWheeledVehicle &Vehicle)
std::vector< CarlaRecorderWalkerBone > Bones
void Write(std::ostream &OutFile)
geom::Transform Transform
Definition: rpc/Transform.h:16
FVehiclePhysicsControl VehiclePhysicsControl
void Write(double DeltaSeconds)
void AddTriggerVolume(const ATrafficSignBase &TrafficSign)
void AddState(const CarlaRecorderStateTrafficLight &State)
double GetVisualGameTime() const
Visual game seconds.
Definition: CarlaEpisode.h:105
ActorType GetActorType() const
Definition: CarlaActor.h:85
A view over an actor and its properties.
Definition: CarlaActor.h:23
void Write(std::ostream &OutFile) const