8#include "Components/ActorComponent.h"
9#include "CoreMinimal.h"
10#include "GameFramework/Actor.h"
19#include "SensorsManagerComponent.generated.h"
53UCLASS(ClassGroup = (Custom), meta = (BlueprintSpawnableComponent))
54class AGRARSENSE_API USensorsManagerComponent :
public UActorComponent
60 USensorsManagerComponent();
62 ~USensorsManagerComponent();
68 UFUNCTION(BlueprintCallable)
74 UFUNCTION(BlueprintCallable)
75 TArray<ALidar*> GetLidars()
const {
return Lidars; }
80 UFUNCTION(BlueprintCallable)
81 TArray<ACamera*> GetCameras()
const {
return Cameras; }
86 UFUNCTION(BlueprintCallable)
87 TArray<AThermalCamera*> GetThermalCameras()
const {
return ThermalCameras; }
92 UFUNCTION(BlueprintCallable)
93 TArray<ADVSCamera*> GetDVSCameras()
const {
return DVSCameras; }
98 UFUNCTION(BlueprintCallable)
99 TArray<ASemanticSegmentationCamera*> GetSegmentationCameras()
const {
return SegmentationCameras; }
104 UFUNCTION(BlueprintCallable)
105 TArray<ADepthCamera*> GetDepthCameras()
const {
return DepthCameras; }
110 UFUNCTION(BlueprintCallable)
111 TArray<ARadar*> GetRadars()
const {
return Radars; }
132 UFUNCTION(BlueprintCallable)
133 ALidar* SpawnLidar(
const FTransform& transform,
bool isTransformRelativeToComponent,
const FString sensorIdentifier,
const FString sensorName,
FLidarParameters lidarParameters,
bool simulateSensor,
ASensorModel*& createdModel, USceneComponent* attachToComponent =
nullptr, FName attachToBone = NAME_None);
148 UFUNCTION(BlueprintCallable)
149 ACamera* SpawnCamera(
const FTransform& transform,
bool isTransformRelativeToComponent,
const FString sensorIdentifier,
const FString sensorName,
FCameraBaseParameters cameraParameters,
bool simulateSensor,
ASensorModel*& createdModel, USceneComponent* attachToComponent =
nullptr, FName attachToBone = NAME_None);
164 UFUNCTION(BlueprintCallable)
165 AThermalCamera* SpawnThermalCamera(
const FTransform& transform,
bool isTransformRelativeToComponent,
const FString sensorIdentifier,
const FString sensorName,
FThermalCameraParameters thermalCameraParameters,
bool simulateSensor,
ASensorModel*& createdModel, USceneComponent* attachToComponent =
nullptr, FName attachToBone = NAME_None);
180 UFUNCTION(BlueprintCallable)
181 ADVSCamera* SpawnDVSCamera(
const FTransform& transform,
bool isTransformRelativeToComponent,
const FString sensorIdentifier,
const FString sensorName,
FDVSCameraParameters DVSCameraParameters,
bool simulateSensor,
ASensorModel*& createdModel, USceneComponent* attachToComponent =
nullptr, FName attachToBone = NAME_None);
196 UFUNCTION(BlueprintCallable)
197 ASemanticSegmentationCamera* SpawnSegmentationCamera(
const FTransform& transform,
bool isTransformRelativeToComponent,
const FString sensorIdentifier,
const FString sensorName,
FCameraBaseParameters CameraParameters,
bool simulateSensor,
ASensorModel*& createdModel, USceneComponent* attachToComponent =
nullptr, FName attachToBone = NAME_None);
212 UFUNCTION(BlueprintCallable)
213 ADepthCamera* SpawnDepthCamera(
const FTransform& transform,
bool isTransformRelativeToComponent,
const FString sensorIdentifier,
const FString sensorName,
FDepthCameraParameters DepthCameraParameters,
bool simulateSensor,
ASensorModel*& createdModel, USceneComponent* attachToComponent =
nullptr, FName attachToBone = NAME_None);
228 UFUNCTION(BlueprintCallable)
229 ARadar* SpawnRadar(
const FTransform& transform,
bool isTransformRelativeToComponent,
const FString sensorIdentifier,
const FString sensorName,
FRadarParameters radarParameters,
bool simulateSensor,
ASensorModel*& createdModel, USceneComponent* attachToComponent =
nullptr, FName attachToBone = NAME_None);
231 UFUNCTION(BlueprintCallable)
245 ASensor* SpawnSensor(
const FTransform& transform,
bool isTransformRelativeToComponent,
const FString sensorIdentifier,
const FString sensorName,
ESensorTypes sensorType,
bool simulateSensor,
ASensorModel*& createdModel, USceneComponent* attachToComponent =
nullptr, FName attachToBone = NAME_None);
251 UFUNCTION(BlueprintCallable)
252 void DestroyLidar(
ALidar* lidarToDestroy);
258 UFUNCTION(BlueprintCallable)
259 void DestroyCamera(
ACamera* cameraToDestroy);
265 UFUNCTION(BlueprintCallable)
266 void DestroyThermalCamera(
AThermalCamera* thermalCameraToDestroy);
272 UFUNCTION(BlueprintCallable)
273 void DestroyDVSCamera(
ADVSCamera* thermalCameraToDestroy);
279 UFUNCTION(BlueprintCallable)
286 UFUNCTION(BlueprintCallable)
287 void DestroyDepthCamera(
ADepthCamera* depthCameraToDestroy);
293 UFUNCTION(BlueprintCallable)
294 void DestroyRadar(
ARadar* radarToDestroy);
300 UFUNCTION(BlueprintCallable)
301 void DestroySensor(
ASensor* sensorToDestroy);
306 UFUNCTION(BlueprintCallable)
307 void DestroyAllSensors();
314 UFUNCTION(BlueprintCallable)
317 UFUNCTION(BlueprintCallable)
325 UFUNCTION(BlueprintCallable)
326 void AttachSensorToActor(
ASensor* sensor, AActor* attachToActor);
334 UFUNCTION(BlueprintCallable)
335 void AttachSensorToBone(
ASensor* sensor, USceneComponent* attachToComponent,
const FName& boneName);
343 UFUNCTION(BlueprintCallable)
344 void AttachSensor(
ASensor* sensor, USceneComponent* attachToComponent,
const FName& boneName);
351 USceneComponent* GetComponentByHierarchyName(FString hierarchyName);
356 UPROPERTY(BlueprintAssignable)
357 FLidarSpawned OnLidarSpawned;
360 UPROPERTY(BlueprintAssignable)
361 FCameraSpawned OnCameraSpawned;
364 UPROPERTY(BlueprintAssignable)
365 FThermalCameraSpawned OnThermalCameraSpawned;
368 UPROPERTY(BlueprintAssignable)
369 FDVSCameraSpawned OnDVSCameraSpawned;
372 UPROPERTY(BlueprintAssignable)
373 FSegmentationCameraSpawned OnSegmentationCameraSpawned;
376 UPROPERTY(BlueprintAssignable)
377 FDepthCameraSpawned OnDepthCameraSpawned;
380 UPROPERTY(BlueprintAssignable)
381 FRadarSpawned OnRadarSpawned;
384 UPROPERTY(BlueprintAssignable)
385 FSensorSpawned OnSensorSpawned;
388 UPROPERTY(BlueprintAssignable)
389 FLidarDestroyed OnLidarDestroyed;
392 UPROPERTY(BlueprintAssignable)
393 FCameraDestroyed OnCameraDestroyed;
396 UPROPERTY(BlueprintAssignable)
397 FThermalCameraDestroyed OnThermalCameraDestroyed;
400 UPROPERTY(BlueprintAssignable)
401 FDVSCameraDestroyed OnDVSCameraDestroyed;
404 UPROPERTY(BlueprintAssignable)
405 FSegmentationCameraDestroyed OnSegmentationCameraDestroyed;
408 UPROPERTY(BlueprintAssignable)
409 FDepthCameraDestroyed OnDepthCameraDestroyed;
412 UPROPERTY(BlueprintAssignable)
413 FRadarDestroyed OnRadarDestroyed;
416 UPROPERTY(BlueprintAssignable)
417 FSensorDestroyed OnSensorDestroyed;
421 static const FString ComponentHierarchySeparator;
429 FTransform SensorRelativeTransformToWorld(
const FTransform& relativeTransform);
437 FTransform SensorRelativeTransformToComponentWorld(
const FTransform& relativeTransform,
const FTransform& componentTransformWorld);
439 FTransform GetSensorAttachmentTransform(
const FTransform& sensorRelativeTransform, USceneComponent* attachToComponent,
const FName& attachToBone,
bool revertScaleToVectorOne =
true);
445 void AttachSensorToOwner(
ASensor* sensor);
451 void DestroySensorActor(AActor* sensorActor);
458 void OnCameraWindowClosed(
ACamera* camera);
464 void AddSensorDestroyListener(
ASensor* sensor);
470 void RemoveSensorDestroyListener(
ASensor* sensor);
477 void OnSensorDestroy(
ASensor* sensor);
DECLARE_DYNAMIC_MULTICAST_DELEGATE_TwoParams(FSensorDestroyed, ESensorTypes, sensorType, FString, sensorIdentifier)
DECLARE_DYNAMIC_MULTICAST_DELEGATE_OneParam(FLidarSpawned, ALidar *, lidar)