CARLA
BoundingBoxCalculator.h
Go to the documentation of this file.
1 // Copyright (c) 2020 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 
11 #include "Kismet/BlueprintFunctionLibrary.h"
12 
13 #include "BoundingBoxCalculator.generated.h"
14 
15 class AActor;
16 
17 UCLASS()
19 {
20  GENERATED_BODY()
21 
22 public:
23 
24  /// Compute the bounding box of the given Carla actor.
25  ///
26  /// @warning If the actor type is not supported a default initialized bounding
27  /// box is returned.
28  ///
29  /// @warning Traffic signs return its trigger box instead.
30  UFUNCTION(Category = "Carla Actor", BlueprintCallable)
31  static FBoundingBox GetActorBoundingBox(
32  const AActor *Actor,
33  uint8 InTagQueried = 0xFF);
34 
35  UFUNCTION(Category = "Carla Actor", BlueprintCallable)
36  static FBoundingBox GetVehicleBoundingBox(
38  uint8 InTagQueried = 0xFF);
39 
40  UFUNCTION(Category = "Carla Actor", BlueprintCallable)
41  static FBoundingBox GetCharacterBoundingBox(
42  const ACharacter* Character,
43  uint8 InTagQueried = 0xFF);
44 
45  UFUNCTION(Category = "Carla Actor", BlueprintCallable)
46  static void GetTrafficLightBoundingBox(
48  TArray<FBoundingBox>& OutBB,
49  TArray<uint8>& OutTag,
50  uint8 InTagQueried = 0xFF);
51 
52  UFUNCTION(Category = "Carla Util", BlueprintCallable)
53  static FBoundingBox GetSkeletalMeshBoundingBox(const USkeletalMesh* SkeletalMesh);
54 
55  UFUNCTION(Category = "Carla Util", BlueprintCallable)
56  static FBoundingBox GetStaticMeshBoundingBox(const UStaticMesh* StaticMesh);
57 
58  UFUNCTION(Category = "Carla Util", BlueprintCallable)
59  static void GetISMBoundingBox(
60  UInstancedStaticMeshComponent* ISMComp,
61  TArray<FBoundingBox>& OutBoundingBox);
62 
63  UFUNCTION(Category = "Carla Util", BlueprintCallable)
64  static void GetBBsOfStaticMeshComponents(
65  const TArray<UStaticMeshComponent*>& StaticMeshComps,
66  TArray<FBoundingBox>& OutBB,
67  TArray<uint8>& OutTag,
68  uint8 InTagQueried = 0xFF);
69 
70  UFUNCTION(Category = "Carla Util", BlueprintCallable)
71  static void GetBBsOfSkeletalMeshComponents(
72  const TArray<USkeletalMeshComponent*>& SkeletalMeshComps,
73  TArray<FBoundingBox>& OutBB,
74  TArray<uint8>& OutTag,
75  uint8 InTagQueried = 0xFF);
76 
77  UFUNCTION(Category = "Carla Util", BlueprintCallable)
78  static TArray<FBoundingBox> GetBoundingBoxOfActors(
79  const TArray<AActor*>& Actors,
80  uint8 InTagQueried = 0xFF);
81 
82  UFUNCTION(Category = "Carla Util", BlueprintCallable)
83  static TArray<FBoundingBox> GetBBsOfActor(
84  const AActor* Actor,
85  uint8 InTagQueried = 0xFF);
86 
87  // Combines the BBs of an actor based on the distance and type of the BB
88  // The BBs not combined are included too (ie: TL BBs and pole)
89  // DistanceThreshold is the maximum distance between BBs to combine, if 0.0 the distance is ignored
90  // TagToCombine defines the type of the BBs to combine, if 0 the type is ignored
91  UFUNCTION(Category = "Carla Util", BlueprintCallable)
92  static void CombineBBsOfActor(
93  const AActor* Actor,
94  TArray<FBoundingBox>& OutBB,
95  TArray<uint8>& OutTag,
96  const float DistanceThreshold = 0.0f,
97  uint8 TagToCombine = 0xFF);
98 
99  UFUNCTION(Category = "Carla Util", BlueprintCallable)
100  static FBoundingBox CombineBBs(const TArray<FBoundingBox>& BBsToCombine);
101 
102  // Returns Static Mesh Components that generate the InBB of the Actor
103  // ie: the SMComps that creates the BB of the TL light box
104  UFUNCTION(Category = "Carla Actor", BlueprintCallable)
105  static void GetMeshCompsFromActorBoundingBox(
106  const AActor* Actor,
107  const FBoundingBox& InBB,
108  TArray<UStaticMeshComponent*>& OutStaticMeshComps);
109 
110 };
carla::SharedPtr< cc::Actor > Actor
Base class for CARLA wheeled vehicles.