Agrarsense
MovementSubscriber.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#include "Components/ActorComponent.h"
10
12
13#include "ROSIntegration/Classes/RI/Topic.h"
14
15#include "MovementSubscriber.generated.h"
16
17USTRUCT(BlueprintType)
19{
20 GENERATED_BODY()
21
23 {
24 this->linear = {0,0,0};
25 this->angular = {0,0,0};
26 }
27
28 UPROPERTY(BlueprintReadOnly)
29 FVector linear;
30
31 UPROPERTY(BlueprintReadOnly)
32 FVector angular;
33};
34
36
37UCLASS( ClassGroup=(Custom), meta=(BlueprintSpawnableComponent) )
38class AGRARSENSE_API UMovementSubscriber : public UActorComponent
39{
40 GENERATED_BODY()
41
42public:
43
44 UMovementSubscriber();
45
46 UPROPERTY(BlueprintAssignable)
47 FMessageReceived OnMessageReceived;
48
49protected:
50
51 virtual void BeginPlay() override;
52
53 virtual void OnUnregister() override;
54
55private:
56
57 UFUNCTION()
58 void ROSBridgeStateChanged(EROSState rosState);
59
60 void CreateROSTopic();
61
62 void DestroyROSTopic();
63
64 UPROPERTY()
65 TObjectPtr<UTopic> MovementTopic;
66
67};
DECLARE_DYNAMIC_MULTICAST_DELEGATE_OneParam(FMessageReceived, FMessageParser, Movement)
EROSState
Definition: ROSState.h:16