Implementation:CARLA simulator Carla WalkerManager Interface
| Knowledge Sources | |
|---|---|
| Domains | Navigation, Pedestrian AI |
| Last Updated | 2026-02-15 05:00 GMT |
Overview
The WalkerManager class manages pedestrian route planning with event-based behavior at crosswalks and intersections, coordinating with the Navigation system and traffic lights.
Description
carla::nav::WalkerManager is a NonCopyable class that maintains a map of walker routes (WalkerInfo) and handles their progression through route points with associated events. Key features:
- Walker lifecycle --
AddWalker()andRemoveWalker()manage walker registration - Route management --
SetWalkerRoute()computes a new route from current position to a target (or random location), producing a sequence ofWalkerRoutePointobjects with events and area types - Route progression --
SetWalkerNextPoint()andGetWalkerNextPoint()advance through route points - Event execution --
Update(delta)processes all walkers, executing events via the visitor pattern - Traffic light awareness --
GetTrafficLightAffecting()finds the nearest traffic light affecting a position - Crosswalk handling --
GetWalkerCrosswalkEnd()returns the endpoint of the current crosswalk for vehicle checking
The WalkerState enum tracks walker states: IDLE, WALKING, IN_EVENT, STOP. Each WalkerInfo stores the from/to locations, current route index, state, and the full route.
Usage
This class is used by the Navigation system to manage high-level walker behavior, particularly the event-driven interactions at crosswalks and traffic lights.
Code Reference
Source Location
- Repository: CARLA
- File:
LibCarla/source/carla/nav/WalkerManager.h
Signature
class WalkerManager : private NonCopyable {
public:
WalkerManager();
~WalkerManager();
void SetNav(Navigation *nav);
void SetSimulator(std::weak_ptr<client::detail::Simulator> simulator);
bool AddWalker(ActorId id);
bool RemoveWalker(ActorId id);
bool Update(double delta);
bool SetWalkerRoute(ActorId id);
bool SetWalkerRoute(ActorId id, geom::Location to);
bool SetWalkerNextPoint(ActorId id);
bool GetWalkerNextPoint(ActorId id, geom::Location &location);
bool GetWalkerCrosswalkEnd(ActorId id, geom::Location &location);
Navigation *GetNavigation();
SharedPtr<client::TrafficLight> GetTrafficLightAffecting(
geom::Location UnrealPos, float max_distance = -1.0f);
};
Import
#include "carla/nav/WalkerManager.h"
I/O Contract
| Input | Type | Description |
|---|---|---|
ActorId | Walker actor identifier
| ||
geom::Location | Target destination for route
| ||
double | Time elapsed since last update
|
| Output | Type | Description |
|---|---|---|
geom::Location & | Next waypoint location (out parameter)
| ||
bool | Whether the operation succeeded
|
Usage Examples
WalkerManager manager;
manager.SetNav(&navigation);
manager.AddWalker(walker_id);
manager.SetWalkerRoute(walker_id, target_location);
manager.Update(delta_seconds);