Manage the pedestrians navigation, using the Recast & Detour library for low level calculations. 更多...
#include <Navigation.h>
Public 成员函数 | |
bool | AddOrUpdateVehicle (VehicleCollisionInfo &vehicle) |
create a new vehicle in crowd to be avoided by walkers | |
bool | AddWalker (ActorId id, carla::geom::Location from) |
create a new walker | |
void | CreateCrowd (void) |
create the crowd object | |
bool | GetAgentRoute (ActorId id, carla::geom::Location from, carla::geom::Location to, std::vector< carla::geom::Location > &path, std::vector< unsigned char > &area) |
dtCrowd * | GetCrowd () |
double | GetDeltaSeconds () |
return the last delta seconds | |
bool | GetPath (carla::geom::Location from, carla::geom::Location to, dtQueryFilter *filter, std::vector< carla::geom::Location > &path, std::vector< unsigned char > &area) |
return the path points to go from one position to another | |
bool | GetRandomLocation (carla::geom::Location &location, dtQueryFilter *filter=nullptr) const |
get a random location for navigation | |
bool | GetWalkerPosition (ActorId id, carla::geom::Location &location) |
get the walker current location | |
float | GetWalkerSpeed (ActorId id) |
get the walker current transform | |
bool | GetWalkerTransform (ActorId id, carla::geom::Transform &trans) |
get the walker current transform | |
bool | HasVehicleNear (ActorId id, float distance, carla::geom::Location direction) |
return if the agent has a vehicle near (as neighbour) | |
bool | IsWalkerAlive (ActorId id, bool &alive) |
return if the agent has been killed by a vehicle | |
bool | Load (const std::string &filename) |
load navigation data | |
bool | Load (std::vector< uint8_t > content) |
load navigation data from memory | |
Navigation () | |
void | PauseAgent (ActorId id, bool pause) |
set an agent as paused for the crowd | |
bool | RemoveAgent (ActorId id) |
remove an agent | |
void | SetPedestriansCrossFactor (float percentage) |
set the probability that an agent could cross the roads in its path following | |
void | SetSeed (unsigned int seed) |
set the seed to use with random numbers | |
void | SetSimulator (std::weak_ptr< carla::client::detail::Simulator > simulator) |
reference to the simulator to access API functions | |
bool | SetWalkerDirectTarget (ActorId id, carla::geom::Location to) |
bool | SetWalkerDirectTargetIndex (int index, carla::geom::Location to) |
bool | SetWalkerLookAt (ActorId id, carla::geom::Location location) |
make agent look at some location | |
bool | SetWalkerMaxSpeed (ActorId id, float max_speed) |
set new max speed | |
bool | SetWalkerTarget (ActorId id, carla::geom::Location to) |
set a new target point to go through a route with events | |
void | UpdateCrowd (const client::detail::EpisodeState &state) |
update all walkers in crowd | |
bool | UpdateVehicles (std::vector< VehicleCollisionInfo > vehicles) |
add/update/delete vehicles in crowd | |
~Navigation () | |
Private 成员函数 | |
void | SetAgentFilter (int agent_index, int filter_index) |
assign a filter index to an agent | |
Private 成员函数 继承自 carla::NonCopyable | |
NonCopyable ()=default | |
NonCopyable (const NonCopyable &)=delete | |
NonCopyable (NonCopyable &&)=delete | |
NonCopyable & | operator= (const NonCopyable &)=delete |
NonCopyable & | operator= (NonCopyable &&)=delete |
Private 属性 | |
std::vector< uint8_t > | _binary_mesh |
dtCrowd * | _crowd { nullptr } |
crowd | |
double | _delta_seconds { 0.0 } |
std::unordered_map< int, ActorId > | _mapped_by_index |
std::unordered_map< ActorId, int > | _mapped_vehicles_id |
std::unordered_map< ActorId, int > | _mapped_walkers_id |
mapping Id | |
std::mutex | _mutex |
dtNavMesh * | _nav_mesh { nullptr } |
meshes | |
dtNavMeshQuery * | _nav_query { nullptr } |
float | _probability_crossing { 0.0f } |
bool | _ready { false } |
std::weak_ptr< carla::client::detail::Simulator > | _simulator |
double | _time_to_unblock { 0.0 } |
WalkerManager | _walker_manager |
walker manager for the route planning with events | |
std::unordered_map< int, carla::geom::Vector3D > | _walkers_blocked_position |
saves the position of each actor at intervals and check if any is blocked | |
std::unordered_map< ActorId, float > | _yaw_walkers |
store walkers yaw angle from previous tick | |
Manage the pedestrians navigation, using the Recast & Detour library for low level calculations.
This class gets the binary content of the map from the server, which is required for the path finding. Then this class can add or remove pedestrians, and also set target points to walk for each one.
在文件 Navigation.h 第 57 行定义.
carla::nav::Navigation::Navigation | ( | ) |
carla::nav::Navigation::~Navigation | ( | ) |
在文件 Navigation.cpp 第 56 行定义.
引用了 _binary_mesh, _crowd, _mapped_by_index, _mapped_vehicles_id, _mapped_walkers_id, _nav_mesh, _nav_query, _ready, _time_to_unblock, _walkers_blocked_position , 以及 _yaw_walkers.
bool carla::nav::Navigation::AddOrUpdateVehicle | ( | VehicleCollisionInfo & | vehicle | ) |
create a new vehicle in crowd to be avoided by walkers
在文件 Navigation.cpp 第 534 行定义.
引用了 _crowd, _mapped_by_index, _mapped_vehicles_id, _mutex, _ready, carla::nav::AGENT_HEIGHT, carla::nav::VehicleCollisionInfo::bounding, DEBUG_ASSERT, carla::nav::DT_CROWD_SEPARATION, carla::geom::BoundingBox::extent, carla::nav::VehicleCollisionInfo::id, carla::geom::Transform::location, carla::logging::log(), carla::geom::Transform::rotation, carla::nav::VehicleCollisionInfo::transform, carla::geom::Vector3D::x, carla::geom::Vector3D::y, carla::geom::Rotation::yaw , 以及 carla::geom::Vector3D::z.
被这些函数引用 UpdateVehicles().
bool carla::nav::Navigation::AddWalker | ( | ActorId | id, |
carla::geom::Location | from ) |
create a new walker
在文件 Navigation.cpp 第 473 行定义.
引用了 _crowd, _mapped_by_index, _mapped_walkers_id, _mutex, _probability_crossing, _ready, _walker_manager, _yaw_walkers, carla::nav::WalkerManager::AddWalker(), carla::nav::AGENT_HEIGHT, carla::nav::AGENT_RADIUS, DEBUG_ASSERT, carla::nav::DT_CROWD_ANTICIPATE_TURNS, carla::nav::DT_CROWD_OBSTACLE_AVOIDANCE, carla::nav::DT_CROWD_SEPARATION, carla::nav::frand(), carla::geom::Vector3D::x, carla::geom::Vector3D::y , 以及 carla::geom::Vector3D::z.
被这些函数引用 carla::client::detail::WalkerNavigation::AddWalker().
void carla::nav::Navigation::CreateCrowd | ( | void | ) |
create the crowd object
在文件 Navigation.cpp 第 201 行定义.
引用了 _crowd, _nav_mesh, _ready, carla::nav::AGENT_RADIUS, carla::nav::AREA_GRASS_COST, carla::nav::AREA_ROAD_COST, carla::nav::CARLA_AREA_GRASS, carla::nav::CARLA_AREA_ROAD, carla::nav::CARLA_TYPE_NONE, carla::nav::CARLA_TYPE_ROAD, carla::nav::CARLA_TYPE_WALKABLE, DEBUG_ASSERT, carla::logging::log() , 以及 carla::nav::MAX_AGENTS.
被这些函数引用 Load().
bool carla::nav::Navigation::GetAgentRoute | ( | ActorId | id, |
carla::geom::Location | from, | ||
carla::geom::Location | to, | ||
std::vector< carla::geom::Location > & | path, | ||
std::vector< unsigned char > & | area ) |
在文件 Navigation.cpp 第 372 行定义.
引用了 _crowd, _mapped_walkers_id, _mutex, _nav_mesh, _nav_query, _ready, DEBUG_ASSERT, carla::nav::MAX_POLYS, carla::geom::Vector3D::x, carla::geom::Vector3D::y , 以及 carla::geom::Vector3D::z.
被这些函数引用 carla::nav::WalkerManager::SetWalkerRoute().
|
inline |
在文件 Navigation.h 第 116 行定义.
引用了 _crowd.
被这些函数引用 carla::client::detail::WalkerNavigation::UpdateVehiclesInCrowd().
|
inline |
bool carla::nav::Navigation::GetPath | ( | carla::geom::Location | from, |
carla::geom::Location | to, | ||
dtQueryFilter * | filter, | ||
std::vector< carla::geom::Location > & | path, | ||
std::vector< unsigned char > & | area ) |
return the path points to go from one position to another
在文件 Navigation.cpp 第 267 行定义.
引用了 _mutex, _nav_mesh, _nav_query, _ready, carla::nav::AREA_GRASS_COST, carla::nav::AREA_ROAD_COST, carla::nav::CARLA_AREA_GRASS, carla::nav::CARLA_AREA_ROAD, carla::nav::CARLA_TYPE_NONE, carla::nav::CARLA_TYPE_WALKABLE, DEBUG_ASSERT, carla::nav::MAX_POLYS, carla::geom::Vector3D::x, carla::geom::Vector3D::y , 以及 carla::geom::Vector3D::z.
bool carla::nav::Navigation::GetRandomLocation | ( | carla::geom::Location & | location, |
dtQueryFilter * | filter = nullptr ) const |
get a random location for navigation
在文件 Navigation.cpp 第 1062 行定义.
引用了 _mutex, _nav_query, _ready, carla::nav::CARLA_TYPE_NONE, carla::nav::CARLA_TYPE_SIDEWALK, DEBUG_ASSERT, carla::nav::frand(), carla::geom::Vector3D::x, carla::geom::Vector3D::y , 以及 carla::geom::Vector3D::z.
被这些函数引用 carla::client::detail::WalkerNavigation::GetRandomLocation(), carla::nav::WalkerManager::SetWalkerRoute() , 以及 UpdateCrowd().
bool carla::nav::Navigation::GetWalkerPosition | ( | ActorId | id, |
carla::geom::Location & | location ) |
get the walker current location
在文件 Navigation.cpp 第 987 行定义.
引用了 _crowd, _mapped_walkers_id, _mutex, _ready, DEBUG_ASSERT, carla::geom::Vector3D::x, carla::geom::Vector3D::y , 以及 carla::geom::Vector3D::z.
被这些函数引用 carla::nav::WalkerEventVisitor::operator()(), carla::nav::WalkerManager::SetWalkerRoute() , 以及 carla::nav::WalkerManager::Update().
float carla::nav::Navigation::GetWalkerSpeed | ( | ActorId | id | ) |
get the walker current transform
在文件 Navigation.cpp 第 1028 行定义.
引用了 _crowd, _mapped_walkers_id, _mutex, _ready , 以及 DEBUG_ASSERT.
被这些函数引用 carla::client::detail::WalkerNavigation::Tick().
bool carla::nav::Navigation::GetWalkerTransform | ( | ActorId | id, |
carla::geom::Transform & | trans ) |
get the walker current transform
在文件 Navigation.cpp 第 923 行定义.
引用了 _crowd, _delta_seconds, _mapped_walkers_id, _mutex, _ready, _yaw_walkers, DEBUG_ASSERT, carla::geom::Transform::location, min(), carla::geom::Transform::rotation, carla::geom::Vector3D::x, carla::geom::Vector3D::y, carla::geom::Rotation::yaw , 以及 carla::geom::Vector3D::z.
被这些函数引用 carla::client::detail::WalkerNavigation::Tick().
bool carla::nav::Navigation::HasVehicleNear | ( | ActorId | id, |
float | distance, | ||
carla::geom::Location | direction ) |
return if the agent has a vehicle near (as neighbour)
在文件 Navigation.cpp 第 1157 行定义.
引用了 _crowd, _mapped_vehicles_id, _mapped_walkers_id, _mutex, carla::geom::Vector3D::x, carla::geom::Vector3D::y , 以及 carla::geom::Vector3D::z.
被这些函数引用 carla::nav::WalkerEventVisitor::operator()().
bool carla::nav::Navigation::IsWalkerAlive | ( | ActorId | id, |
bool & | alive ) |
return if the agent has been killed by a vehicle
在文件 Navigation.cpp 第 1214 行定义.
引用了 _crowd, _mapped_walkers_id, _mutex, _ready , 以及 DEBUG_ASSERT.
被这些函数引用 carla::client::detail::WalkerNavigation::Tick().
bool carla::nav::Navigation::Load | ( | const std::string & | filename | ) |
load navigation data
在文件 Navigation.cpp 第 83 行定义.
引用了 Load().
被这些函数引用 Load() , 以及 carla::client::detail::WalkerNavigation::WalkerNavigation().
bool carla::nav::Navigation::Load | ( | std::vector< uint8_t > | content | ) |
load navigation data from memory
在文件 Navigation.cpp 第 100 行定义.
引用了 _binary_mesh, _nav_mesh, _nav_query, _ready, CreateCrowd(), carla::logging::log() , 以及 carla::nav::MAX_QUERY_SEARCH_NODES.
void carla::nav::Navigation::PauseAgent | ( | ActorId | id, |
bool | pause ) |
set an agent as paused for the crowd
在文件 Navigation.cpp 第 1125 行定义.
引用了 _crowd, _mapped_walkers_id, _mutex, _ready , 以及 DEBUG_ASSERT.
被这些函数引用 carla::nav::WalkerEventVisitor::operator()() , 以及 carla::nav::WalkerManager::SetWalkerNextPoint().
bool carla::nav::Navigation::RemoveAgent | ( | ActorId | id | ) |
remove an agent
在文件 Navigation.cpp 第 663 行定义.
引用了 _crowd, _mapped_by_index, _mapped_vehicles_id, _mapped_walkers_id, _mutex, _ready, _walker_manager, DEBUG_ASSERT , 以及 carla::nav::WalkerManager::RemoveWalker().
被这些函数引用 carla::client::detail::WalkerNavigation::CheckIfWalkerExist(), carla::client::detail::WalkerNavigation::RemoveWalker(), carla::client::detail::WalkerNavigation::Tick() , 以及 UpdateVehicles().
|
private |
assign a filter index to an agent
在文件 Navigation.cpp 第 1103 行定义.
被这些函数引用 UpdateCrowd().
void carla::nav::Navigation::SetPedestriansCrossFactor | ( | float | percentage | ) |
set the probability that an agent could cross the roads in its path following
在文件 Navigation.cpp 第 1119 行定义.
被这些函数引用 carla::client::detail::WalkerNavigation::SetPedestriansCrossFactor().
void carla::nav::Navigation::SetSeed | ( | unsigned int | seed | ) |
set the seed to use with random numbers
在文件 Navigation.cpp 第 78 行定义.
被这些函数引用 carla::client::detail::WalkerNavigation::SetPedestriansSeed().
void carla::nav::Navigation::SetSimulator | ( | std::weak_ptr< carla::client::detail::Simulator > | simulator | ) |
reference to the simulator to access API functions
在文件 Navigation.cpp 第 71 行定义.
引用了 _simulator, _walker_manager , 以及 carla::nav::WalkerManager::SetSimulator().
被这些函数引用 carla::client::detail::WalkerNavigation::WalkerNavigation().
bool carla::nav::Navigation::SetWalkerDirectTarget | ( | ActorId | id, |
carla::geom::Location | to ) |
在文件 Navigation.cpp 第 782 行定义.
引用了 _mapped_walkers_id, _ready , 以及 SetWalkerDirectTargetIndex().
被这些函数引用 carla::nav::WalkerManager::SetWalkerNextPoint().
bool carla::nav::Navigation::SetWalkerDirectTargetIndex | ( | int | index, |
carla::geom::Location | to ) |
在文件 Navigation.cpp 第 799 行定义.
引用了 _crowd, _mutex, _nav_query, _ready, DEBUG_ASSERT, carla::geom::Vector3D::x, carla::geom::Vector3D::y , 以及 carla::geom::Vector3D::z.
被这些函数引用 SetWalkerDirectTarget().
bool carla::nav::Navigation::SetWalkerLookAt | ( | ActorId | id, |
carla::geom::Location | location ) |
make agent look at some location
在文件 Navigation.cpp 第 1178 行定义.
引用了 _crowd, _mapped_vehicles_id, _mapped_walkers_id, _mutex, carla::geom::Vector3D::x, carla::geom::Vector3D::y , 以及 carla::geom::Vector3D::z.
bool carla::nav::Navigation::SetWalkerMaxSpeed | ( | ActorId | id, |
float | max_speed ) |
set new max speed
在文件 Navigation.cpp 第 735 行定义.
引用了 _crowd, _mapped_walkers_id, _mutex, _ready , 以及 DEBUG_ASSERT.
被这些函数引用 carla::client::detail::WalkerNavigation::SetWalkerMaxSpeed().
bool carla::nav::Navigation::SetWalkerTarget | ( | ActorId | id, |
carla::geom::Location | to ) |
set a new target point to go through a route with events
在文件 Navigation.cpp 第 765 行定义.
引用了 _mapped_walkers_id, _ready, _walker_manager , 以及 carla::nav::WalkerManager::SetWalkerRoute().
被这些函数引用 carla::client::detail::WalkerNavigation::SetWalkerTarget().
void carla::nav::Navigation::UpdateCrowd | ( | const client::detail::EpisodeState & | state | ) |
update all walkers in crowd
在文件 Navigation.cpp 第 834 行定义.
引用了 _crowd, _delta_seconds, _mapped_by_index, _mutex, _probability_crossing, _ready, _time_to_unblock, _walker_manager, _walkers_blocked_position, carla::nav::AGENT_UNBLOCK_DISTANCE_SQUARED, carla::nav::AGENT_UNBLOCK_TIME, DEBUG_ASSERT, carla::nav::frand(), GetRandomLocation(), carla::client::detail::EpisodeState::GetTimestamp(), SetAgentFilter(), carla::nav::WalkerManager::SetWalkerRoute(), carla::geom::Vector3D::SquaredLength() , 以及 carla::nav::WalkerManager::Update().
被这些函数引用 carla::client::detail::WalkerNavigation::Tick().
bool carla::nav::Navigation::UpdateVehicles | ( | std::vector< VehicleCollisionInfo > | vehicles | ) |
add/update/delete vehicles in crowd
在文件 Navigation.cpp 第 709 行定义.
引用了 _mapped_vehicles_id, AddOrUpdateVehicle() , 以及 RemoveAgent().
被这些函数引用 carla::client::detail::WalkerNavigation::UpdateVehiclesInCrowd().
|
private |
在文件 Navigation.h 第 124 行定义.
被这些函数引用 Load() , 以及 ~Navigation().
|
private |
crowd
在文件 Navigation.h 第 130 行定义.
被这些函数引用 AddOrUpdateVehicle(), AddWalker(), CreateCrowd(), GetAgentRoute(), GetCrowd(), GetWalkerPosition(), GetWalkerSpeed(), GetWalkerTransform(), HasVehicleNear(), IsWalkerAlive(), PauseAgent(), RemoveAgent(), SetAgentFilter(), SetWalkerDirectTargetIndex(), SetWalkerLookAt(), SetWalkerMaxSpeed(), UpdateCrowd() , 以及 ~Navigation().
|
private |
在文件 Navigation.h 第 125 行定义.
被这些函数引用 GetDeltaSeconds(), GetWalkerTransform() , 以及 UpdateCrowd().
|
private |
在文件 Navigation.h 第 135 行定义.
被这些函数引用 AddOrUpdateVehicle(), AddWalker(), RemoveAgent(), UpdateCrowd() , 以及 ~Navigation().
|
private |
在文件 Navigation.h 第 133 行定义.
被这些函数引用 AddOrUpdateVehicle(), HasVehicleNear(), RemoveAgent(), SetWalkerLookAt(), UpdateVehicles() , 以及 ~Navigation().
|
private |
mapping Id
在文件 Navigation.h 第 132 行定义.
被这些函数引用 AddWalker(), GetAgentRoute(), GetWalkerPosition(), GetWalkerSpeed(), GetWalkerTransform(), HasVehicleNear(), IsWalkerAlive(), PauseAgent(), RemoveAgent(), SetWalkerDirectTarget(), SetWalkerLookAt(), SetWalkerMaxSpeed(), SetWalkerTarget() , 以及 ~Navigation().
|
mutableprivate |
在文件 Navigation.h 第 147 行定义.
被这些函数引用 AddOrUpdateVehicle(), AddWalker(), GetAgentRoute(), GetPath(), GetRandomLocation(), GetWalkerPosition(), GetWalkerSpeed(), GetWalkerTransform(), HasVehicleNear(), IsWalkerAlive(), PauseAgent(), RemoveAgent(), SetAgentFilter(), SetWalkerDirectTargetIndex(), SetWalkerLookAt(), SetWalkerMaxSpeed() , 以及 UpdateCrowd().
|
private |
meshes
在文件 Navigation.h 第 127 行定义.
被这些函数引用 CreateCrowd(), GetAgentRoute(), GetPath(), Load() , 以及 ~Navigation().
|
private |
在文件 Navigation.h 第 128 行定义.
被这些函数引用 GetAgentRoute(), GetPath(), GetRandomLocation(), Load(), SetWalkerDirectTargetIndex() , 以及 ~Navigation().
|
private |
在文件 Navigation.h 第 149 行定义.
被这些函数引用 AddWalker(), SetPedestriansCrossFactor() , 以及 UpdateCrowd().
|
private |
在文件 Navigation.h 第 123 行定义.
被这些函数引用 AddOrUpdateVehicle(), AddWalker(), CreateCrowd(), GetAgentRoute(), GetPath(), GetRandomLocation(), GetWalkerPosition(), GetWalkerSpeed(), GetWalkerTransform(), IsWalkerAlive(), Load(), PauseAgent(), RemoveAgent(), SetWalkerDirectTarget(), SetWalkerDirectTargetIndex(), SetWalkerMaxSpeed(), SetWalkerTarget(), UpdateCrowd() , 以及 ~Navigation().
|
private |
在文件 Navigation.h 第 145 行定义.
被这些函数引用 SetSimulator().
|
private |
在文件 Navigation.h 第 140 行定义.
被这些函数引用 UpdateCrowd() , 以及 ~Navigation().
|
private |
walker manager for the route planning with events
在文件 Navigation.h 第 143 行定义.
被这些函数引用 AddWalker(), Navigation(), RemoveAgent(), SetSimulator(), SetWalkerTarget() , 以及 UpdateCrowd().
|
private |
saves the position of each actor at intervals and check if any is blocked
在文件 Navigation.h 第 139 行定义.
被这些函数引用 UpdateCrowd() , 以及 ~Navigation().
|
private |
store walkers yaw angle from previous tick
在文件 Navigation.h 第 137 行定义.
被这些函数引用 AddWalker(), GetWalkerTransform() , 以及 ~Navigation().