CARLA
Toggle main menu visibility
Loading...
Searching...
No Matches
Unreal
CarlaUnreal
Plugins
Carla
Source
Carla
Walker
WalkerController.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 "
Carla/Walker/WalkerBoneControlIn.h
"
10
#include "
Carla/Walker/WalkerBoneControlOut.h
"
11
#include "
Carla/Walker/WalkerControl.h
"
12
13
#include <
util/disable-ue4-macros.h
>
14
#include <
carla/rpc/WalkerBoneControlIn.h
>
15
#include <
util/enable-ue4-macros.h
>
16
17
#include <util/ue-header-guard-begin.h>
18
#include "CoreMinimal.h"
19
#include "AIController.h"
20
#include <util/ue-header-guard-end.h>
21
22
#include "WalkerController.generated.h"
23
24
/// Possesses every walker pawn. Historically a plain AController that only
25
/// relayed the client-computed FWalkerControl into the character movement;
26
/// it is now an AAIController with a UCrowdFollowingComponent so the server
27
/// can also path-follow on the engine navmesh (server-side pedestrian
28
/// navigation on World Partition maps). Manual FWalkerControl input and
29
/// navmesh following are mutually exclusive: applying a manual control
30
/// aborts any active navigation request.
31
UCLASS()
32
class CARLA_API
AWalkerController
: public
AAIController
33
{
34
GENERATED_BODY()
35
36
public
:
37
38
AWalkerController
(
const
FObjectInitializer &ObjectInitializer);
39
40
void
OnPossess
(
APawn
*InPawn)
override
;
41
42
void
Tick
(
float
DeltaSeconds)
override
;
43
44
/// Maximum walk speed allowed in centimetres per second.
45
UFUNCTION(BlueprintCallable)
46
float
GetMaximumWalkSpeed
()
const
47
{
48
return
4096.0f;
// ~147 km/h
49
}
50
51
UFUNCTION(BlueprintCallable)
52
void
ApplyWalkerControl(
const
FWalkerControl
&InControl);
53
54
UFUNCTION(BlueprintCallable)
55
const
FWalkerControl
GetWalkerControl
()
const
56
{
57
return
Control
;
58
}
59
60
UFUNCTION(BlueprintCallable)
61
void
GetBonesTransform(
FWalkerBoneControlOut
&WalkerBones);
62
63
UFUNCTION(BlueprintCallable)
64
void
SetBonesTransform(
const
FWalkerBoneControlIn
&WalkerBones);
65
66
UFUNCTION(BlueprintCallable)
67
void
BlendPose(
float
Blend);
68
69
UFUNCTION(BlueprintCallable)
70
void
GetPoseFromAnimation();
71
72
/// -- Server-side navmesh navigation ---------------------------------------
73
74
/// Enter navigation mode (idempotent). Returns false if no walker pawn is
75
/// possessed. The manual control input is suppressed while navigating.
76
/// @a bIsCrosser selects the query filter: crossers may traverse
77
/// road/crosswalk nav areas (drawn once per walker by the episode with
78
/// probability pedestrians_cross_factor); the flag is ignored when
79
/// navigation is already active, so repeated Start calls cannot re-draw.
80
bool
StartNavigation(
bool
bIsCrosser =
false
);
81
82
/// Path-follow to @a WorldLocation (world-local centimeters) on the navmesh
83
/// through the crowd following component. Implies StartNavigation().
84
bool
GoToNavLocation(
const
FVector &WorldLocation);
85
86
/// Walking speed used while navigating, in cm/s. The manual control path
87
/// scales its input against GetMaximumWalkSpeed(), so the character's
88
/// MaxWalkSpeed is only lowered to this value while navigation is active
89
/// and restored when it stops.
90
bool
SetNavMaxSpeed(
float
SpeedCmPerSec);
91
92
/// Abort any navigation request and return to manual control.
93
bool
StopNavigation();
94
95
bool
IsNavigationActive
()
const
96
{
97
return
bNavigationActive
;
98
}
99
100
private
:
101
102
void
SetNavigationActive(
bool
bActive);
103
104
FWalkerControl
Control
;
105
106
/// Walking speed applied while navigating, cm/s (defaults to the usual
107
/// pedestrian speed the Python clients use, 1.39 m/s).
108
float
NavMaxSpeed
= 139.0f;
109
110
bool
bNavigationActive
=
false
;
111
112
/// Whether this walker may traverse road/crosswalk nav areas. Drawn once
113
/// per walker when its navigation starts.
114
bool
bNavCrosser
=
false
;
115
};
WalkerBoneControlIn.h
WalkerBoneControlIn.h
WalkerBoneControlOut.h
WalkerControl.h
AAIController
APawn
AWalkerController::bNavCrosser
bool bNavCrosser
Whether this walker may traverse road/crosswalk nav areas.
Definition
WalkerController.h:114
AWalkerController::bNavigationActive
bool bNavigationActive
Definition
WalkerController.h:110
AWalkerController::Tick
void Tick(float DeltaSeconds) override
Definition
WalkerController.cpp:280
AWalkerController::IsNavigationActive
bool IsNavigationActive() const
Definition
WalkerController.h:95
AWalkerController::GetMaximumWalkSpeed
float GetMaximumWalkSpeed() const
Maximum walk speed allowed in centimetres per second.
Definition
WalkerController.h:46
AWalkerController::Control
FWalkerControl Control
Definition
WalkerController.h:104
AWalkerController::NavMaxSpeed
float NavMaxSpeed
Walking speed applied while navigating, cm/s (defaults to the usual pedestrian speed the Python clien...
Definition
WalkerController.h:108
AWalkerController::AWalkerController
AWalkerController(const FObjectInitializer &ObjectInitializer)
Definition
WalkerController.cpp:23
AWalkerController::OnPossess
void OnPossess(APawn *InPawn) override
Definition
WalkerController.cpp:32
AWalkerController::GetWalkerControl
const FWalkerControl GetWalkerControl() const
Definition
WalkerController.h:55
disable-ue4-macros.h
enable-ue4-macros.h
FWalkerBoneControlIn
Definition
Unreal/CarlaUnreal/Plugins/Carla/Source/Carla/Walker/WalkerBoneControlIn.h:13
FWalkerBoneControlOut
Definition
Unreal/CarlaUnreal/Plugins/Carla/Source/Carla/Walker/WalkerBoneControlOut.h:22
FWalkerControl
Definition
Unreal/CarlaUnreal/Plugins/Carla/Source/Carla/Walker/WalkerControl.h:13
Generated by
1.18.0