Agrarsense
InfoTopic.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
11
12#include "ROSIntegration/Public/std_msgs/String.h"
13#include "ROSIntegration/Classes/RI/Topic.h"
14
15#include "InfoTopic.generated.h"
16
17/*
18* ROS Info topic class.
19* This class creates /Agrarsense/Info topic and publishes what's currently happening in the Simulation,
20* new sensor spawned/destroyed etc.
21*
22* To send message from cpp side:
23* #include "Agrarsense/ROS/InfoTopic/InfoTopic.h"
24* UInfoTopic::SendMessage("Hello");
25*/
26UCLASS()
27class AGRARSENSE_API UInfoTopic : public UObject
28{
29
30 GENERATED_BODY()
31
32public:
33
34 static void SetAllowSendInfo(bool Allow);
35
36 static void SendMessage(const FString& Message);
37
38private:
39
40 // Allow AAgrarsenseGameModeBase to access private methods
42
43 static void Init();
44
45 static void Destroy();
46
47 void Setup();
48
49 void SetupROSInfoTopic();
50
51 void DestroyROSTopic();
52
53 UFUNCTION()
54 void ROSBridgeStateChanged(EROSState state);
55
56 static UInfoTopic* Instance;
57
58 static TWeakObjectPtr<UTopic> InfoTopic;
59
60 static TSharedPtr<ROSMessages::std_msgs::String> ROSMessage;
61
62 static bool ROSConnected;
63
64 static bool AllowInfoTopic;
65
66};
EROSState
Definition: ROSState.h:16