5#include "CoreMinimal.h"
8#include "PIDDrone.generated.h"
13class USkeletalMeshComponent;
14class UStaticMeshComponent;
37 return mesh->GetComponentTransform();
41 return GetActorTransform();
48 UFUNCTION(BlueprintCallable, Category =
"Drone")
51 DroneParameters.DroneAction = mode;
58 UFUNCTION(BlueprintCallable, Category =
"Drone")
61 return DroneParameters.DroneAction;
64 UFUNCTION(BlueprintCallable, Category =
"Drone")
67 return DroneParameters;
70 UFUNCTION(BlueprintCallable, Category =
"Drone")
73 UE_LOG(LogTemp, Warning, TEXT(
"Parameters Chnaged!"));
74 SetDroneParameters(newParameters);
79 DroneParameters = InParameters;
83 UFUNCTION(BlueprintCallable, Category =
"Drone")
84 void AddWayPoint(FVector waypoint)
87 transform.SetLocation(waypoint);
89 DroneParameters.
Points.Add(transform);
92 UFUNCTION(BlueprintCallable, Category =
"Drone")
95 DroneParameters.Points.Empty();
101 UFUNCTION(BlueprintCallable, Category =
"Drone")
102 void FlySetFlightpath();
104 UFUNCTION(BlueprintCallable, Category = "
Drone")
105 void SetManualControl(
bool value) {
106 manualControl = value;
113 void MoveDroneToPosition(
const FTransform
Transform);
120 UFUNCTION(BlueprintCallable, Category =
"Drone")
121 TArray<FTransform> GenerateRoamingPoints(
float radius,
int roamingPoints);
123 bool manualControl = false;
127 virtual
void BeginPlay() override;
129 virtual
void Tick(
float DeltaTime) override;
131 virtual
void EndPlay(const EEndPlayReason::Type EndPlayReason) override;
133 void AutoPilot(
float DeltaTime);
141 UWorld* World =
nullptr;
143 FVector StartingPosition;
145 USkeletalMeshComponent* mesh =
nullptr;
146 UStaticMeshComponent* desiredPositionMesh =
nullptr;
148 bool bRosConnected = false;
149 bool waypointreached = false;
152 TArray<FVector> WayPoints = {
154 {11779.536955,6566.541435,5000}
162 int passedWaypoints = 0;
168 UFUNCTION(BlueprintCallable)
169 FVector GetCurrentWaypointTarget();
171 UFUNCTION(BlueprintCallable)
172 void SetDesiredLocationMesh(UStaticMeshComponent *meshcomponent) {
173 desiredPositionMesh = meshcomponent;
176 UFUNCTION(BlueprintCallable)
177 void AssignRoamingPoints(TArray<FTransform> Points)
183 for (FTransform point : Points)
186 WayPoints.Add(point.GetLocation());
190 UFUNCTION(BlueprintCallable)
191 void SetDroneRotation(USkeletalMeshComponent* target, FRotator rotator);
virtual FTransform GetInteractableWorldTransform_Implementation() const override
void SetDroneParameters(const FDroneParameters &InParameters)
FDroneParameters DroneParameters
virtual EVehicleTypes GetVehicleType() const override
TArray< FTransform > Points