#include <WalkerManager.h>
Public Member Functions | |
bool | AddWalker (ActorId id) |
create a new walker route More... | |
Navigation * | GetNavigation () |
return the navigation object More... | |
SharedPtr< carla::client::TrafficLight > | GetTrafficLightAffecting (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 | |
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 |
Definition at line 45 of file WalkerManager.h.
carla::nav::WalkerManager::WalkerManager | ( | ) |
Definition at line 20 of file WalkerManager.cpp.
carla::nav::WalkerManager::~WalkerManager | ( | ) |
Definition at line 23 of file WalkerManager.cpp.
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().
|
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().
|
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().
|
inline |
return the navigation object
Definition at line 81 of file WalkerManager.h.
Referenced by carla::nav::WalkerEventVisitor::operator()().
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()().
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()().
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.
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().
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().
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().
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().
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().
bool carla::nav::WalkerManager::SetWalkerRoute | ( | ActorId | id, |
carla::geom::Location | to | ||
) |
Definition at line 128 of file WalkerManager.cpp.
References _nav, _walkers, carla::nav::CARLA_AREA_CROSSWALK, carla::nav::CARLA_AREA_ROAD, carla::nav::CARLA_AREA_SIDEWALK, carla::nav::WalkerInfo::currentIndex, carla::nav::WalkerInfo::from, carla::nav::Navigation::GetAgentRoute(), carla::nav::Navigation::GetWalkerPosition(), carla::nav::WalkerInfo::route, SetWalkerNextPoint(), carla::nav::WalkerInfo::state, carla::nav::WalkerInfo::to, and carla::nav::WALKER_IDLE.
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().
|
private |
Definition at line 94 of file WalkerManager.h.
Referenced by GetWalkerCrosswalkEnd(), GetWalkerNextPoint(), SetNav(), SetWalkerNextPoint(), SetWalkerRoute(), and Update().
|
private |
Definition at line 95 of file WalkerManager.h.
Referenced by GetAllTrafficLightWaypoints(), and SetSimulator().
|
private |
Definition at line 93 of file WalkerManager.h.
Referenced by GetAllTrafficLightWaypoints(), and GetTrafficLightAffecting().
|
private |
Definition at line 92 of file WalkerManager.h.
Referenced by AddWalker(), GetWalkerCrosswalkEnd(), GetWalkerNextPoint(), RemoveWalker(), SetWalkerNextPoint(), SetWalkerRoute(), and Update().