CARLA
Loading...
Searching...
No Matches
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:

Public Member Functions

bool AddWalker (ActorId id)
 create a new walker route
 
Navigation * GetNavigation ()
 return the navigation object
 
SharedPtr< carla::client::TrafficLight > GetTrafficLightAffecting (carla::geom::Location UnrealPos, float max_distance=-1.0f)
 return the trafficlight affecting that position
 
bool GetWalkerCrosswalkEnd (ActorId id, carla::geom::Location &location)
 get the point in the route that end current crosswalk
 
bool GetWalkerNextPoint (ActorId id, carla::geom::Location &location)
 get the next point in the route
 
bool RemoveWalker (ActorId id)
 remove a walker route
 
void SetNav (Navigation *nav)
 assign the navigation module
 
void SetSimulator (std::weak_ptr< carla::client::detail::Simulator > simulator)
 reference to the simulator to access API functions
 
bool SetWalkerNextPoint (ActorId id)
 set the next point in the route
 
bool SetWalkerRoute (ActorId id)
 set a new route from its current position
 
bool SetWalkerRoute (ActorId id, carla::geom::Location to)
 
bool Update (double delta)
 update all routes
 
 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
 
NonCopyable & operator= (const NonCopyable &)=delete
 
NonCopyable & operator= (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 19 of file WalkerManager.cpp.

◆ ~WalkerManager()

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

Definition at line 22 of file WalkerManager.cpp.

Member Function Documentation

◆ AddWalker()

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

create a new walker route

Definition at line 36 of file WalkerManager.cpp.

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

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

◆ ExecuteEvent()

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

◆ GetAllTrafficLightWaypoints()

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

Definition at line 285 of file WalkerManager.cpp.

References _simulator, _traffic_lights, and carla::client::World::GetActors().

Referenced by AddWalker().

◆ GetNavigation()

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

return the navigation object

Definition at line 81 of file WalkerManager.h.

References _nav.

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

◆ 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 316 of file WalkerManager.cpp.

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

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

◆ 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 249 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()().

◆ GetWalkerNextPoint()

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

get the next point in the route

Definition at line 227 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 49 of file WalkerManager.cpp.

References _walkers.

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

◆ SetNav()

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

assign the navigation module

Definition at line 26 of file WalkerManager.cpp.

References _nav.

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

◆ 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 31 of file WalkerManager.cpp.

References _simulator.

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

◆ SetWalkerNextPoint()

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

◆ SetWalkerRoute() [1/2]

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

◆ SetWalkerRoute() [2/2]

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

◆ Update()

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

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: