Agrarsense
SimulatorJsonExporter.h
Go to the documentation of this file.
1// Copyright (c) 2023 FrostBit Software Lab at the Lapland University of Applied Sciences
2//
3// This work is licensed under the terms of the MIT license.
4// For a copy, see <https://opensource.org/licenses/MIT>.
5
6#pragma once
7
8#include "CoreMinimal.h"
9#include "EngineMinimal.h"
10#include "Kismet/BlueprintFunctionLibrary.h"
11#include "JsonObjectConverter.h"
12#include "Dom/JsonObject.h"
13#include "JsonUtilities.h"
14#include "Json.h"
15
18
19#include "SimulatorJsonExporter.generated.h"
20
21class AInstancedActor;
22class AVehicle;
23class ASensor;
24class ALidar;
25class ACamera;
26class AThermalCamera;
27class ADepthCamera;
29class ADVSCamera;
30class ARadar;
31class AWalker;
32
37UCLASS()
38class AGRARSENSE_API USimulatorJsonExporter : public UBlueprintFunctionLibrary
39{
40
41 GENERATED_BODY()
42
43public:
44
52 UFUNCTION(BlueprintCallable, Category = "ROS JSON Utilities")
53 static FString ExportInstancedActorsToJSON(FString FileName, const TArray<AInstancedActor*>& Actors);
54
55
64 UFUNCTION(BlueprintCallable, Category = "ROS JSON Utilities")
65 static FString ExportVehicleAndSensorsToJSON(FString FileName, AVehicle* Vehicle, bool OverrideTransform = false, const FTransform& Transform = FTransform());
66
73 UFUNCTION(BlueprintCallable, Category = "ROS JSON Utilities")
74 static FString ExportWeatherToJSON(const FString& FileName, const FWeatherParameters& WeatherParameters);
75
82 UFUNCTION(BlueprintCallable, Category = "ROS JSON Utilities")
83 static FString ExportWalkerToJSON(const FString& FileName, AWalker* Walker);
84
85
92 UFUNCTION(BlueprintCallable, Category = "ROS JSON Utilities")
93 static FString ExportSensorToJSON(const FString& FileName, ASensor* Sensor);
94
95private:
96
97 static TArray<TSharedPtr<FJsonValue>> ParseLidars(const TArray<ALidar*>& Lidars);
98
99 static TArray<TSharedPtr<FJsonValue>> ParseCameras(const TArray<ACamera*>& Cameras);
100
101 static TArray<TSharedPtr<FJsonValue>> ParseDepthCameras(const TArray<ADepthCamera*>& DepthCameras);
102
103 static TArray<TSharedPtr<FJsonValue>> ParseThermalCameras(const TArray<AThermalCamera*>& ThermalCameras);
104
105 static TArray<TSharedPtr<FJsonValue>> ParseDVSCameras(const TArray<ADVSCamera*>& DVSCameras);
106
107 static TArray<TSharedPtr<FJsonValue>> ParseRadars(const TArray<ARadar*>& Radars);
108
109 static TSharedPtr<FJsonObject> CreateSensorJSONObject(const ASensor* SensorPtr, FString SensorName);
110
111 static TSharedPtr<FJsonObject> CameraParametersToJSONObject(const FCameraBaseParameters& Parameters);
112
113 static void SetSpawnPoint(TSharedPtr<FJsonObject>& ObjectEntry, const FVector& Location, const FRotator& Rotation, const FVector& Scale);
114
121 static FString CreateUniqueFilePath(FString FileName);
122
123};
Definition: Camera.h:52
Definition: Lidar.h:34
Definition: Radar.h:26
Definition: Sensor.h:44
Definition: Walker.h:28