CARLA
OpenDriveGenerator.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 #pragma once
7 
8 #include "CoreMinimal.h"
9 #include "GameFramework/Actor.h"
10 #include "ProceduralMeshComponent.h"
11 
13 #include <boost/optional.hpp>
14 #include "carla/road/Map.h"
16 
18 
19 #include "OpenDriveGenerator.generated.h"
20 
21 UCLASS()
22 class CARLA_API AProceduralMeshActor : public AActor
23 {
24  GENERATED_BODY()
25 public:
27 
28  UPROPERTY(Category = "Procedural Mesh Actor", VisibleDefaultsOnly, BlueprintReadOnly, meta = (AllowPrivateAccess = "true"))
29  UProceduralMeshComponent* MeshComponent;
30 };
31 
32 UCLASS()
33 class CARLA_API AOpenDriveGenerator : public AActor
34 {
35  GENERATED_BODY()
36 
37 public:
38 
39  AOpenDriveGenerator(const FObjectInitializer &ObjectInitializer);
40 
41  /// Set the OpenDRIVE information as string and generates the
42  /// queryable map structure.
43  bool LoadOpenDrive(const FString &OpenDrive);
44 
45  /// Get the OpenDRIVE information as string.
46  const FString &GetOpenDrive() const;
47 
48  /// Checks if the OpenDrive has been loaded and it's valid.
49  bool IsOpenDriveValid() const;
50 
51  /// Generates the road and sidewalk mesh based on the OpenDRIVE information.
52  void GenerateRoadMesh();
53 
54  /// Generates pole meshes based on the OpenDRIVE information.
55  void GeneratePoles();
56 
57  /// Generates spawn points along the road.
58  void GenerateSpawnPoints();
59 
60  void GenerateAll();
61 
62 protected:
63 
64  virtual void BeginPlay() override;
65 
66  /// Determine the height where the spawners will be placed, relative to each
67  /// RoutePlanner
68  UPROPERTY(Category = "Spawners", EditAnywhere)
69  float SpawnersHeight = 300.f;
70 
71  UPROPERTY(Category = "Spawners", EditAnywhere)
72  TArray<AVehicleSpawnPoint *> VehicleSpawners;
73 
74  UPROPERTY(EditAnywhere)
75  FString OpenDriveData;
76 
77  UPROPERTY(EditAnywhere)
78  TArray<AActor *> ActorMeshList;
79 
80 };
Base class for spawner locations for walkers.