8#include "CoreMinimal.h"
12#include "Components/SkeletalMeshComponent.h"
13#include "Components/StaticMeshComponent.h"
15#include "ROSIntegration/Public/std_msgs/Float32.h"
17#include "PIDDrone.generated.h"
38 if (DroneSkeletalMesh)
40 return DroneSkeletalMesh->GetComponentTransform();
44 return GetActorTransform();
51 UFUNCTION(BlueprintCallable, Category =
"Drone")
54 DroneParameters.DroneAction = mode;
61 UFUNCTION(BlueprintCallable, Category =
"Drone")
64 return DroneParameters.DroneAction;
67 UFUNCTION(BlueprintCallable, Category =
"Drone")
70 return DroneParameters;
73 UFUNCTION(BlueprintCallable, Category =
"Drone")
77 UE_LOG(LogTemp, Warning, TEXT(
"Parameters Changed!"));
79 SetDroneParameters(newParameters);
84 DroneParameters = InParameters;
87 UFUNCTION(BlueprintCallable, Category =
"Drone")
88 void AddWayPoint(FVector Waypoint)
91 transform.SetLocation(Waypoint);
93 DroneParameters.
Points.Add(transform);
96 UFUNCTION(BlueprintCallable, Category =
"Drone")
99 DroneParameters.Points.Empty();
105 UFUNCTION(BlueprintCallable, Category =
"Drone")
106 void SetFlightpath();
108 UFUNCTION(BlueprintCallable, Category = "
Drone")
109 void SetManualControl(
bool value)
111 manualControl = value;
118 void MoveDroneToPosition(
const FTransform
Transform);
125 UFUNCTION(BlueprintCallable, Category =
"Drone")
126 TArray<FTransform> GenerateRoamingPoints(
float radius, int32 roamingPoints);
128 virtual
void SetCurrentTransformToMovedFromGarageTransform()
override
130 if (DroneSkeletalMesh)
132 MovedFromGarageTransform = DroneSkeletalMesh->GetComponentTransform();
133 UE_LOG(LogTemp, Warning, TEXT(
"Moved from garage transform %s"), *MovedFromGarageTransform.ToString());
138 MovedFromGarageTransform = GetActorTransform();
139 UE_LOG(LogTemp, Warning, TEXT(
"ACTOR Moved from garage transform WHAT IS THIS: %s"), *MovedFromGarageTransform.ToString());
146 ShowForwardArrow = Show;
149 UFUNCTION(BlueprintCallable, Category =
"Drone")
150 bool GetShowForwardArrow()
const
152 return ShowForwardArrow;
157 void ROSBridgeStateChanged(
EROSState ROSState)
override;
160 UTopic* ROSTopic =
nullptr;
162 TSharedPtr<ROSMessages::std_msgs::Float32> ROSMessage;
166 virtual
void BeginPlay() override;
168 virtual
void Tick(
float DeltaTime) override;
170 virtual
void EndPlay(const EEndPlayReason::Type EndPlayReason) override;
176 void AutoPilot(const
float DeltaTime);
178 UFUNCTION(BlueprintCallable)
179 void AssignRoamingPoints(const TArray<FTransform> Points);
181 UFUNCTION(BlueprintCallable)
182 void SetDroneRotation(USkeletalMeshComponent* target, FRotator rotator);
184 void UpdateGroundHeight();
186 UFUNCTION(BlueprintCallable)
187 bool IsRoaming()
const
192 UFUNCTION(BlueprintCallable)
193 void SetDesiredLocationMesh(UStaticMeshComponent* meshcomponent)
195 PositionMesh = meshcomponent;
198 UFUNCTION(BlueprintCallable)
199 FVector GetCurrentWaypointTarget();
207 UWorld* World =
nullptr;
209 FVector StartingPosition;
212 USkeletalMeshComponent* DroneSkeletalMesh =
nullptr;
215 UStaticMeshComponent* PositionMesh =
nullptr;
218 TArray<FVector> WayPoints = {
220 {11779.536955,6566.541435,5000}
223 bool waypointReached =
false;
225 bool manualControl =
false;
227 bool ShowForwardArrow =
false;
229 int32 passedWaypoints = 0;
231 float DroneHeightFromGround = 0.0f;
static EDroneAction GetDroneAction(FString actionstring)
virtual FTransform GetInteractableWorldTransform_Implementation() const override
void SetDroneParameters(const FDroneParameters &InParameters)
FDroneParameters DroneParameters
virtual EVehicleTypes GetVehicleType() const override
void SetShowForwardArrow(bool Show)
TArray< FTransform > Points