CARLA
Loading...
Searching...
No Matches
VehicleVelocityControl.h
Go to the documentation of this file.
1// Copyright (c) 2026 Computer Vision Center (CVC) at the Universitat Autonoma
2// de Barcelona (UAB).
3//
4// This work is licensed under the terms of the MIT license.
5// For a copy, see <https://opensource.org/licenses/MIT>.
6
7#pragma once
8
9#include <util/ue-header-guard-begin.h>
10#include "Components/ActorComponent.h"
11#include "Components/PrimitiveComponent.h"
12#include "CoreMinimal.h"
13#include <util/ue-header-guard-end.h>
14
15#include "VehicleVelocityControl.generated.h"
16
17/// Component that controls that the velocity of an actor is constant.
18UCLASS(Blueprintable, BlueprintType, ClassGroup=(Custom), meta=(BlueprintSpawnableComponent))
19class CARLA_API UVehicleVelocityControl : public UActorComponent
20{
21 GENERATED_BODY()
22
23 // ===========================================================================
24 /// @name Constructor and destructor
25 // ===========================================================================
26 /// @{
27public:
28 UVehicleVelocityControl();
29
30 /// @}
31 // ===========================================================================
32 /// @name Get functions
33 // ===========================================================================
34 /// @{
35public:
36
37 void BeginPlay() override;
38
39 virtual void TickComponent(float DeltaTime, enum ELevelTick TickType, FActorComponentTickFunction *ThisTickFunction) override;
40
41 // Activate the component setting the target velocity
42 virtual void Activate(bool bReset=false) override;
43
44 // Activate the component setting the target velocity
45 virtual void Activate(FVector Velocity, bool bReset=false);
46
47 // Deactivate the component
48 virtual void Deactivate() override;
49
50private:
51 ///
52 UPROPERTY(Category = "Vehicle Velocity Control", VisibleAnywhere)
53 FVector TargetVelocity;
54
55 UPROPERTY(Transient, DuplicateTransient)
56 TObjectPtr<UPrimitiveComponent> PrimitiveComponent;
57
58 UPROPERTY(Transient, DuplicateTransient)
59 TObjectPtr<AActor> OwnerVehicle;
60
61};