CARLA
Public Member Functions | Private Member Functions | Private Attributes | List of all members
carla::nav::WalkerManager Class Reference

#include <WalkerManager.h>

+ Inheritance diagram for carla::nav::WalkerManager:
+ Collaboration diagram for carla::nav::WalkerManager:

Public Member Functions

bool AddWalker (ActorId id)
 create a new walker route More...
 
NavigationGetNavigation ()
 return the navigation object More...
 
SharedPtr< carla::client::TrafficLightGetTrafficLightAffecting (carla::geom::Location UnrealPos, float max_distance=-1.0f)
 return the trafficlight affecting that position More...
 
bool GetWalkerCrosswalkEnd (ActorId id, carla::geom::Location &location)
 get the point in the route that end current crosswalk More...
 
bool GetWalkerNextPoint (ActorId id, carla::geom::Location &location)
 get the next point in the route More...
 
bool RemoveWalker (ActorId id)
 remove a walker route More...
 
void SetNav (Navigation *nav)
 assign the navigation module More...
 
void SetSimulator (std::weak_ptr< carla::client::detail::Simulator > simulator)
 reference to the simulator to access API functions More...
 
bool SetWalkerNextPoint (ActorId id)
 set the next point in the route More...
 
bool SetWalkerRoute (ActorId id)
 set a new route from its current position More...
 
bool SetWalkerRoute (ActorId id, carla::geom::Location to)
 
bool Update (double delta)
 update all routes More...
 
 WalkerManager ()
 
 ~WalkerManager ()
 

Private Member Functions

EventResult ExecuteEvent (ActorId id, WalkerInfo &info, double delta)
 
void GetAllTrafficLightWaypoints ()
 
- Private Member Functions inherited from carla::NonCopyable
 NonCopyable ()=default
 
 NonCopyable (const NonCopyable &)=delete
 
 NonCopyable (NonCopyable &&)=delete
 
NonCopyableoperator= (const NonCopyable &)=delete
 
NonCopyableoperator= (NonCopyable &&)=delete
 

Private Attributes

Navigation_nav { nullptr }
 
std::weak_ptr< carla::client::detail::Simulator_simulator
 
std::vector< std::pair< SharedPtr< carla::client::TrafficLight >, carla::geom::Location > > _traffic_lights
 
std::unordered_map< ActorId, WalkerInfo_walkers
 

Detailed Description

Definition at line 45 of file WalkerManager.h.

Constructor & Destructor Documentation

◆ WalkerManager()

carla::nav::WalkerManager::WalkerManager ( )

Definition at line 20 of file WalkerManager.cpp.

◆ ~WalkerManager()

carla::nav::WalkerManager::~WalkerManager ( )

Definition at line 23 of file WalkerManager.cpp.

Member Function Documentation

◆ AddWalker()

bool carla::nav::WalkerManager::AddWalker ( ActorId  id)

create a new walker route

Definition at line 37 of file WalkerManager.cpp.

References _walkers, GetAllTrafficLightWaypoints(), carla::nav::WalkerInfo::state, and carla::nav::WALKER_IDLE.

Referenced by carla::nav::Navigation::AddWalker().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ ExecuteEvent()

EventResult carla::nav::WalkerManager::ExecuteEvent ( ActorId  id,
WalkerInfo info,
double  delta 
)
private

Definition at line 267 of file WalkerManager.cpp.

References carla::nav::WalkerInfo::currentIndex, carla::nav::WalkerRoutePoint::event, and carla::nav::WalkerInfo::route.

Referenced by Update().

+ Here is the caller graph for this function:

◆ GetAllTrafficLightWaypoints()

void carla::nav::WalkerManager::GetAllTrafficLightWaypoints ( )
private

Definition at line 277 of file WalkerManager.cpp.

References _simulator, _traffic_lights, carla::client::World::GetActor(), and carla::client::TrafficLight::GetStopWaypoints().

Referenced by AddWalker().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ GetNavigation()

Navigation* carla::nav::WalkerManager::GetNavigation ( )
inline

return the navigation object

Definition at line 81 of file WalkerManager.h.

Referenced by carla::nav::WalkerEventVisitor::operator()().

+ Here is the caller graph for this function:

◆ GetTrafficLightAffecting()

SharedPtr< carla::client::TrafficLight > carla::nav::WalkerManager::GetTrafficLightAffecting ( carla::geom::Location  UnrealPos,
float  max_distance = -1.0f 
)

return the trafficlight affecting that position

Definition at line 306 of file WalkerManager.cpp.

References _traffic_lights, and carla::geom::Location::DistanceSquared().

Referenced by carla::nav::WalkerEventVisitor::operator()().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ GetWalkerCrosswalkEnd()

bool carla::nav::WalkerManager::GetWalkerCrosswalkEnd ( ActorId  id,
carla::geom::Location location 
)

get the point in the route that end current crosswalk

Definition at line 241 of file WalkerManager.cpp.

References _nav, _walkers, carla::nav::CARLA_AREA_CROSSWALK, carla::nav::WalkerInfo::currentIndex, and carla::nav::WalkerInfo::route.

Referenced by carla::nav::WalkerEventVisitor::operator()().

+ Here is the caller graph for this function:

◆ GetWalkerNextPoint()

bool carla::nav::WalkerManager::GetWalkerNextPoint ( ActorId  id,
carla::geom::Location location 
)

get the next point in the route

Definition at line 219 of file WalkerManager.cpp.

References _nav, _walkers, carla::nav::WalkerInfo::currentIndex, and carla::nav::WalkerInfo::route.

◆ RemoveWalker()

bool carla::nav::WalkerManager::RemoveWalker ( ActorId  id)

remove a walker route

Definition at line 50 of file WalkerManager.cpp.

References _walkers.

Referenced by carla::nav::Navigation::RemoveAgent().

+ Here is the caller graph for this function:

◆ SetNav()

void carla::nav::WalkerManager::SetNav ( Navigation nav)

assign the navigation module

Definition at line 27 of file WalkerManager.cpp.

References _nav.

Referenced by carla::nav::Navigation::Navigation().

+ Here is the caller graph for this function:

◆ SetSimulator()

void carla::nav::WalkerManager::SetSimulator ( std::weak_ptr< carla::client::detail::Simulator simulator)

reference to the simulator to access API functions

Definition at line 32 of file WalkerManager.cpp.

References _simulator.

Referenced by carla::nav::Navigation::SetSimulator().

+ Here is the caller graph for this function:

◆ SetWalkerNextPoint()

bool carla::nav::WalkerManager::SetWalkerNextPoint ( ActorId  id)

set the next point in the route

Definition at line 184 of file WalkerManager.cpp.

References _nav, _walkers, carla::nav::WalkerInfo::currentIndex, carla::nav::Navigation::PauseAgent(), carla::nav::WalkerInfo::route, carla::nav::Navigation::SetWalkerDirectTarget(), SetWalkerRoute(), carla::nav::WalkerInfo::state, carla::nav::WALKER_STOP, and carla::nav::WALKER_WALKING.

Referenced by SetWalkerRoute(), and Update().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ SetWalkerRoute() [1/2]

bool carla::nav::WalkerManager::SetWalkerRoute ( ActorId  id)

set a new route from its current position

Definition at line 114 of file WalkerManager.cpp.

References _nav, and carla::nav::Navigation::GetRandomLocation().

Referenced by SetWalkerNextPoint(), carla::nav::Navigation::SetWalkerTarget(), Update(), and carla::nav::Navigation::UpdateCrowd().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ SetWalkerRoute() [2/2]

bool carla::nav::WalkerManager::SetWalkerRoute ( ActorId  id,
carla::geom::Location  to 
)

◆ Update()

bool carla::nav::WalkerManager::Update ( double  delta)

update all routes

Definition at line 61 of file WalkerManager.cpp.

References _nav, _walkers, carla::nav::Continue, carla::nav::WalkerInfo::currentIndex, carla::nav::End, ExecuteEvent(), carla::nav::Navigation::GetWalkerPosition(), carla::nav::WalkerInfo::route, SetWalkerNextPoint(), SetWalkerRoute(), carla::geom::Vector3D::SquaredLength(), carla::nav::WalkerInfo::state, carla::nav::TimeOut, carla::nav::WALKER_IDLE, carla::nav::WALKER_IN_EVENT, carla::nav::WALKER_STOP, carla::nav::WALKER_WALKING, carla::geom::Vector3D::x, carla::geom::Vector3D::y, and carla::geom::Vector3D::z.

Referenced by carla::nav::Navigation::UpdateCrowd().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Member Data Documentation

◆ _nav

Navigation* carla::nav::WalkerManager::_nav { nullptr }
private

◆ _simulator

std::weak_ptr<carla::client::detail::Simulator> carla::nav::WalkerManager::_simulator
private

Definition at line 95 of file WalkerManager.h.

Referenced by GetAllTrafficLightWaypoints(), and SetSimulator().

◆ _traffic_lights

std::vector<std::pair<SharedPtr<carla::client::TrafficLight>, carla::geom::Location> > carla::nav::WalkerManager::_traffic_lights
private

Definition at line 93 of file WalkerManager.h.

Referenced by GetAllTrafficLightWaypoints(), and GetTrafficLightAffecting().

◆ _walkers

std::unordered_map<ActorId, WalkerInfo> carla::nav::WalkerManager::_walkers
private

The documentation for this class was generated from the following files: