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->Throttle = 0.0;
25 this->Break = 0.0;
26 this->Steering = 0.0;
27 }
28 UPROPERTY(BlueprintReadOnly)
29 float Throttle = 0.0;
30
31 UPROPERTY(BlueprintReadOnly)
32 float Break = 0.0;
33
34 UPROPERTY(BlueprintReadOnly)
35 float Steering = 0;
36};
37
39
40UCLASS( ClassGroup=(Custom), meta=(BlueprintSpawnableComponent) )
41class AGRARSENSE_API UMovementSubscriber : public UActorComponent
42{
43 GENERATED_BODY()
44
45public:
46
47 UMovementSubscriber();
48
49 UPROPERTY(BlueprintAssignable)
50 FMessageReceived OnMessageReceived;
51
52protected:
53
54 virtual void BeginPlay() override;
55
56 virtual void OnUnregister() override;
57
58private:
59
60 UFUNCTION()
61 void ROSBridgeStateChanged(EROSState rosState);
62
63 void CreateROSTopic();
64
65 void DestroyROSTopic();
66
67 UPROPERTY()
68 TObjectPtr<UTopic> MovementTopic;
69
70};
DECLARE_DYNAMIC_MULTICAST_DELEGATE_OneParam(FMessageReceived, FMessageParser, Movement)
EROSState
Definition: ROSState.h:16