10#include "GeoReferencingSystem.h"
11#include "Kismet/GameplayStatics.h"
12#include "Engine/World.h"
17 PrimaryActorTick.bCanEverTick =
false;
25 ROSMessages::geometry_msgs::Transform transformMsg;
26 TransformMessage = MakeShared<ROSMessages::geometry_msgs::Transform>(transformMsg);
37 SetActorEnableCollision(
false);
45 Super::EndPlay(EndPlayReason);
56 Super::CreateROSTopic();
63 FString TopicName = FString::Printf(TEXT(
"/agrarsense/out/sensors/%s"), *
GetSensorIdentifier());
64 int32 LastSlashIndex = TopicName.Find(TEXT(
"/"), ESearchCase::IgnoreCase, ESearchDir::FromEnd);
65 if (LastSlashIndex != INDEX_NONE)
67 TopicName = TopicName.Left(LastSlashIndex) + TEXT(
"/gnss");
71 TopicName += TEXT(
"/gnss");
74 GnssTopic = NewObject<UTopic>(UTopic::StaticClass());
85 Super::DestroyROSTopic();
99 AActor* TargetActor =
Target.Get();
105 FTransform CurrentTransform = TargetActor->GetTransform();
106 FVector CurrentPos = CurrentTransform.GetLocation();
107 FQuat CurrentRot = CurrentTransform.GetRotation();
142 double Latitude = GeographicCoordinates.Latitude;
143 double Longitude = GeographicCoordinates.Longitude;
144 double Altitude = GeographicCoordinates.Altitude;
147 FString GnssDataString = FString::Printf(TEXT(
"%f, %f, %f"), Latitude, Longitude, Altitude);
static auto BindTick(ObjectType *Object, FunctionType Function)
UROSIntegrationGameInstance * ROSInstance
bool CanSimulateSensor() const
FString GetSensorIdentifier() const
void SetSimulateSensor(bool SimulateSensor)
UTopic * GetROSTopic() const
bool IsROSConnected() const
static void RemoveTick(FTickEntry TickEntry)
static FTickEntry AddTick(UObject *Object, std::function< void(float)> Function, ETickType Type)
static FGeographicCoordinates UnrealToGeographicCoordinates(AGeoReferencingSystem *GeoReferencingSystem, const FVector &Position)