CARLA
Loading...
Searching...
No Matches
WheeledVehicleMovementComponentNW.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 "ChaosWheeledVehicleMovementComponent.h"
11#include "Curves/CurveFloat.h"
12#include <util/ue-header-guard-end.h>
13
14#include "WheeledVehicleMovementComponentNW.generated.h"
15
16USTRUCT()
18{
19 GENERATED_USTRUCT_BODY()
20
21 /** If True, torque is applied to this wheel */
22 UPROPERTY(EditAnywhere, Category = Setup)
23 bool bDriven;
24
26 : bDriven(true)
27 { }
28};
29
30USTRUCT()
32{
33 GENERATED_USTRUCT_BODY()
34
35 /** Torque (Nm) at a given RPM*/
36 UPROPERTY(EditAnywhere, Category = Setup)
37 FRuntimeFloatCurve TorqueCurve;
38
39 /** Maximum revolutions per minute of the engine */
40 UPROPERTY(EditAnywhere, Category = Setup, meta = (ClampMin = "0.01", UIMin = "0.01"))
41 float MaxRPM = 0.0F;
42
43 /** Moment of inertia of the engine around the axis of rotation (Kgm^2). */
44 UPROPERTY(EditAnywhere, Category = Setup, meta = (ClampMin = "0.01", UIMin = "0.01"))
45 float MOI = 0.0F;
46
47 /** Damping rate of engine when full throttle is applied (Kgm^2/s) */
48 UPROPERTY(EditAnywhere, Category = Setup, AdvancedDisplay, meta = (ClampMin = "0.0", UIMin = "0.0"))
49 float DampingRateFullThrottle = 0.0F;
50
51 /** Damping rate of engine in at zero throttle when the clutch is engaged (Kgm^2/s)*/
52 UPROPERTY(EditAnywhere, Category = Setup, AdvancedDisplay, meta = (ClampMin = "0.0", UIMin = "0.0"))
53 float DampingRateZeroThrottleClutchEngaged = 0.0F;
54
55 /** Damping rate of engine in at zero throttle when the clutch is disengaged (in neutral gear) (Kgm^2/s)*/
56 UPROPERTY(EditAnywhere, Category = Setup, AdvancedDisplay, meta = (ClampMin = "0.0", UIMin = "0.0"))
57 float DampingRateZeroThrottleClutchDisengaged = 0.0F;
58
59 /** Find the peak torque produced by the TorqueCurve */
60 float FindPeakTorque() const;
61};
62
63USTRUCT()
65{
66 GENERATED_USTRUCT_BODY()
67
68 /** Determines the amount of torque multiplication*/
69 UPROPERTY(EditAnywhere, Category = Setup)
70 float Ratio = 0.0F;
71
72 /** Value of engineRevs/maxEngineRevs that is low enough to gear down*/
73 UPROPERTY(EditAnywhere, meta = (ClampMin = "0.0", UIMin = "0.0", ClampMax = "1.0", UIMax = "1.0"), Category = Setup)
74 float DownRatio = 0.0F;
75
76 /** Value of engineRevs/maxEngineRevs that is high enough to gear up*/
77 UPROPERTY(EditAnywhere, meta = (ClampMin = "0.0", UIMin = "0.0", ClampMax = "1.0", UIMax = "1.0"), Category = Setup)
78 float UpRatio = 0.0F;
79};
80
81USTRUCT()
83{
84 GENERATED_USTRUCT_BODY()
85 /** Whether to use automatic transmission */
86 UPROPERTY(EditAnywhere, Category = VehicleSetup, meta = (DisplayName = "Automatic Transmission"))
87 bool bUseAutomaticGears = false;
88
89 /** Time it takes to switch gears (seconds) */
90 UPROPERTY(EditAnywhere, Category = Setup, meta = (ClampMin = "0.0", UIMin = "0.0"))
91 float GearChangeTime = 0.0F;
92
93 /** Minimum time it takes the automatic transmission to initiate a gear change (seconds)*/
94 UPROPERTY(EditAnywhere, Category = Setup, meta = (editcondition = "bUseAutomaticGears", ClampMin = "0.0", UIMin = "0.0"))
95 float GearAutoBoxLatency = 0.0F;
96
97 /** The final gear ratio multiplies the transmission gear ratios.*/
98 UPROPERTY(EditAnywhere, AdvancedDisplay, Category = Setup)
99 float FinalRatio = 0.0F;
100
101 /** Forward gear ratios (up to 30) */
102 UPROPERTY(EditAnywhere, Category = Setup, AdvancedDisplay)
103 TArray<FVehicleNWGearData> ForwardGearRatios;
104
105 /** Reverse gear ratio */
106 UPROPERTY(EditAnywhere, AdvancedDisplay, Category = Setup)
107 float ReverseGearRatio = 0.0F;
108
109 /** Value of engineRevs/maxEngineRevs that is high enough to increment gear*/
110 UPROPERTY(EditAnywhere, AdvancedDisplay, Category = Setup, meta = (ClampMin = "0.0", UIMin = "0.0", ClampMax = "1.0", UIMax = "1.0"))
111 float NeutralGearUpRatio = 0.0F;
112
113 /** Strength of clutch (Kgm^2/s)*/
114 UPROPERTY(EditAnywhere, Category = Setup, AdvancedDisplay, meta = (ClampMin = "0.0", UIMin = "0.0"))
115 float ClutchStrength = 0.0F;
116};
117
118UCLASS(ClassGroup = (Physics), meta = (BlueprintSpawnableComponent), hidecategories = (PlanarMovement, "Components|Movement|Planar", Activation, "Components|Activation"))
119class CARLA_API UWheeledVehicleMovementComponentNW :
120 public UChaosWheeledVehicleMovementComponent
121{
122 GENERATED_UCLASS_BODY()
123
124 /** Engine */
125 //UPROPERTY(EditAnywhere, Category = MechanicalSetup)
126 //FVehicleNWEngineData EngineSetupEXT;
127
128 /** Differential */
129 //UPROPERTY(EditAnywhere, Category = MechanicalSetup)
130 //TArray<FVehicleNWWheelDifferentialData> DifferentialSetupEXT;
131
132 /** Transmission data */
133 //UPROPERTY(EditAnywhere, Category = MechanicalSetup)
134 //FVehicleNWTransmissionData TransmissionSetupEXT;
135
136 /** Maximum steering versus forward speed (km/h) */
137 //UPROPERTY(EditAnywhere, Category = SteeringSetup)
138 //FRuntimeFloatCurve SteeringCurve;
139
140#if WITH_EDITOR
141 virtual void PostEditChangeProperty(struct FPropertyChangedEvent& PropertyChangedEvent) override;
142#endif
143
144protected:
145
146};