CARLA
 
载入中...
搜索中...
未找到
CarSimManagerComponent.h
浏览该文件的文档.
1// Copyright (c) 2021 Computer Vision Center (CVC) at the Universitat Autonoma
2// de Barcelona (UAB).
3// Copyright (c) 2019 Intel Corporation
4//
5// This work is licensed under the terms of the MIT license.
6// For a copy, see <https://opensource.org/licenses/MIT>.
7
8#pragma once
9
12
13#ifdef WITH_CARSIM
14#include "CarSimMovementComponent.h"
15#endif
16
17#include "CarSimManagerComponent.generated.h"
18
20
21UCLASS(Blueprintable, meta=(BlueprintSpawnableComponent) )
23{
24 GENERATED_BODY()
25
26 #ifdef WITH_CARSIM
27 AActor* OffsetActor;
28
29 UCarSimMovementComponent * CarSimMovementComponent;
30 #endif
31
32public:
33
34 static void CreateCarsimComponent(
35 ACarlaWheeledVehicle* Vehicle, FString Simfile);
36
37 FString SimfilePath = "";
38
39 virtual void BeginPlay() override;
40
41 virtual void TickComponent(float DeltaTime, ELevelTick TickType, FActorComponentTickFunction* ThisTickFunction) override;
42
43 void ProcessControl(FVehicleControl &Control) override;
44
45 FVector GetVelocity() const override;
46
47 virtual void EndPlay(const EEndPlayReason::Type EndPlayReason) override;
48
49 void UseCarSimRoad(bool bEnabled);
50
51 int32 GetVehicleCurrentGear() const override;
52
53 float GetVehicleForwardSpeed() const override;
54
55 void DisableCarSimPhysics();
56
57 virtual void DisableSpecialPhysics() override;
58
59private:
60
61 // On car mesh hit, only works when carsim is enabled
62 UFUNCTION()
63 void OnCarSimHit(AActor *Actor,
64 AActor *OtherActor,
65 FVector NormalImpulse,
66 const FHitResult &Hit);
67
68 // On car mesh overlap, only works when carsim is enabled
69 // (this event triggers when overlapping with static environment)
70 UFUNCTION()
71 void OnCarSimOverlap(UPrimitiveComponent* OverlappedComponent,
72 AActor* OtherActor,
73 UPrimitiveComponent* OtherComp,
74 int32 OtherBodyIndex,
75 bool bFromSweep,
76 const FHitResult & SweepResult);
77
78 // On car mesh overlap end, only works when carsim is enabled
79 // (this event triggers when overlapping with static environment)
80 UFUNCTION()
81 void OnCarSimEndOverlap(UPrimitiveComponent* OverlappedComponent,
82 AActor* OtherActor,
83 UPrimitiveComponent* OtherComp,
84 int32 OtherBodyIndex);
85};
Base class for CARLA wheeled vehicles.
virtual void BeginPlay() override
int32 GetVehicleCurrentGear() const
Active gear of the vehicle.
float GetVehicleForwardSpeed() const
Forward speed in cm/s. Might be negative if goes backwards.
virtual FVector GetVelocity() const override
virtual void EndPlay(const EEndPlayReason::Type EndPlayReason)