CARLA
VehicleVelocityControl.h
Go to the documentation of this file.
1 // Copyright (c) 2020 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 "Components/ActorComponent.h"
10 #include "Components/PrimitiveComponent.h"
11 #include "CoreMinimal.h"
12 
13 #include "VehicleVelocityControl.generated.h"
14 
15 /// Component that controls that the velocity of an actor is constant.
16 UCLASS(Blueprintable, BlueprintType, ClassGroup=(Custom), meta=(BlueprintSpawnableComponent))
17 class CARLA_API UVehicleVelocityControl : public UActorComponent
18 {
19  GENERATED_BODY()
20 
21  // ===========================================================================
22  /// @name Constructor and destructor
23  // ===========================================================================
24  /// @{
25 public:
26  UVehicleVelocityControl();
27 
28  /// @}
29  // ===========================================================================
30  /// @name Get functions
31  // ===========================================================================
32  /// @{
33 public:
34 
35  void BeginPlay() override;
36 
37  virtual void TickComponent(float DeltaTime, enum ELevelTick TickType, FActorComponentTickFunction *ThisTickFunction) override;
38 
39  // Activate the component setting the target velocity
40  virtual void Activate(bool bReset=false) override;
41 
42  // Activate the component setting the target velocity
43  virtual void Activate(FVector Velocity, bool bReset=false);
44 
45  // Deactivate the component
46  virtual void Deactivate() override;
47 
48 private:
49  ///
50  UPROPERTY(Category = "Vehicle Velocity Control", VisibleAnywhere)
51  FVector TargetVelocity;
52 
53  UPrimitiveComponent* PrimitiveComponent;
54  AActor* OwnerVehicle;
55 
56 };