CARLA
Toggle main menu visibility
Loading...
Searching...
No Matches
Unreal
CarlaUnreal
Plugins
Carla
Source
Carla
Vehicle
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
16
USTRUCT()
17
struct
FVehicleNWWheelDifferentialData
18
{
19
GENERATED_USTRUCT_BODY()
20
21
/** If True, torque is applied to this wheel */
22
UPROPERTY(EditAnywhere, Category = Setup)
23
bool
bDriven
;
24
25
FVehicleNWWheelDifferentialData
()
26
:
bDriven
(true)
27
{ }
28
};
29
30
USTRUCT()
31
struct
FVehicleNWEngineData
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
63
USTRUCT()
64
struct
FVehicleNWGearData
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
81
USTRUCT()
82
struct
FVehicleNWTransmissionData
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
118
UCLASS(ClassGroup = (Physics), meta = (BlueprintSpawnableComponent), hidecategories = (PlanarMovement,
"Components|Movement|Planar"
, Activation,
"Components|Activation"
))
119
class 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
144
protected
:
145
146
};
FVehicleNWEngineData
Definition
WheeledVehicleMovementComponentNW.h:32
FVehicleNWEngineData::MOI
float MOI
Moment of inertia of the engine around the axis of rotation (Kgm^2).
Definition
WheeledVehicleMovementComponentNW.h:45
FVehicleNWEngineData::MaxRPM
float MaxRPM
Maximum revolutions per minute of the engine.
Definition
WheeledVehicleMovementComponentNW.h:41
FVehicleNWEngineData::DampingRateFullThrottle
float DampingRateFullThrottle
Damping rate of engine when full throttle is applied (Kgm^2/s).
Definition
WheeledVehicleMovementComponentNW.h:49
FVehicleNWEngineData::FindPeakTorque
float FindPeakTorque() const
Find the peak torque produced by the TorqueCurve.
Definition
WheeledVehicleMovementComponentNW.cpp:112
FVehicleNWEngineData::DampingRateZeroThrottleClutchEngaged
float DampingRateZeroThrottleClutchEngaged
Damping rate of engine in at zero throttle when the clutch is engaged (Kgm^2/s).
Definition
WheeledVehicleMovementComponentNW.h:53
FVehicleNWEngineData::TorqueCurve
FRuntimeFloatCurve TorqueCurve
Torque (Nm) at a given RPM.
Definition
WheeledVehicleMovementComponentNW.h:37
FVehicleNWEngineData::DampingRateZeroThrottleClutchDisengaged
float DampingRateZeroThrottleClutchDisengaged
Damping rate of engine in at zero throttle when the clutch is disengaged (in neutral gear) (Kgm^2/s).
Definition
WheeledVehicleMovementComponentNW.h:57
FVehicleNWGearData
Definition
WheeledVehicleMovementComponentNW.h:65
FVehicleNWGearData::Ratio
float Ratio
Determines the amount of torque multiplication.
Definition
WheeledVehicleMovementComponentNW.h:70
FVehicleNWGearData::DownRatio
float DownRatio
Value of engineRevs/maxEngineRevs that is low enough to gear down.
Definition
WheeledVehicleMovementComponentNW.h:74
FVehicleNWGearData::UpRatio
float UpRatio
Value of engineRevs/maxEngineRevs that is high enough to gear up.
Definition
WheeledVehicleMovementComponentNW.h:78
FVehicleNWTransmissionData
Definition
WheeledVehicleMovementComponentNW.h:83
FVehicleNWTransmissionData::bUseAutomaticGears
bool bUseAutomaticGears
Whether to use automatic transmission.
Definition
WheeledVehicleMovementComponentNW.h:87
FVehicleNWTransmissionData::GearChangeTime
float GearChangeTime
Time it takes to switch gears (seconds).
Definition
WheeledVehicleMovementComponentNW.h:91
FVehicleNWTransmissionData::ForwardGearRatios
TArray< FVehicleNWGearData > ForwardGearRatios
Forward gear ratios (up to 30).
Definition
WheeledVehicleMovementComponentNW.h:103
FVehicleNWTransmissionData::NeutralGearUpRatio
float NeutralGearUpRatio
Value of engineRevs/maxEngineRevs that is high enough to increment gear.
Definition
WheeledVehicleMovementComponentNW.h:111
FVehicleNWTransmissionData::ClutchStrength
float ClutchStrength
Strength of clutch (Kgm^2/s).
Definition
WheeledVehicleMovementComponentNW.h:115
FVehicleNWTransmissionData::FinalRatio
float FinalRatio
The final gear ratio multiplies the transmission gear ratios.
Definition
WheeledVehicleMovementComponentNW.h:99
FVehicleNWTransmissionData::ReverseGearRatio
float ReverseGearRatio
Reverse gear ratio.
Definition
WheeledVehicleMovementComponentNW.h:107
FVehicleNWTransmissionData::GearAutoBoxLatency
float GearAutoBoxLatency
Minimum time it takes the automatic transmission to initiate a gear change (seconds).
Definition
WheeledVehicleMovementComponentNW.h:95
FVehicleNWWheelDifferentialData::FVehicleNWWheelDifferentialData
FVehicleNWWheelDifferentialData()
Definition
WheeledVehicleMovementComponentNW.h:25
FVehicleNWWheelDifferentialData::bDriven
bool bDriven
If True, torque is applied to this wheel.
Definition
WheeledVehicleMovementComponentNW.h:23
Generated by
1.18.0