16#include <recast/Recast.h>
17#include <recast/DetourCrowd.h>
18#include <recast/DetourNavMesh.h>
19#include <recast/DetourNavMeshBuilder.h>
20#include <recast/DetourNavMeshQuery.h>
21#include <recast/DetourCommon.h>
65 bool Load(
const std::string &filename);
67 bool Load(std::vector<uint8_t> content);
70 std::vector<carla::geom::Location> &path, std::vector<unsigned char> &area);
72 std::vector<carla::geom::Location> &path, std::vector<unsigned char> &area);
75 void SetSimulator(std::weak_ptr<carla::client::detail::Simulator> simulator);
77 void SetSeed(
unsigned int seed);
Inherit (privately) to suppress copy/move construction and assignment.
Represents the state of all the actors of an episode at a given frame.
Manage the pedestrians navigation, using the Recast & Detour library for low level calculations.
bool SetWalkerMaxSpeed(ActorId id, float max_speed)
set new max speed
void UpdateCrowd(const client::detail::EpisodeState &state)
update all walkers in crowd
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
void SetAgentFilter(int agent_index, int filter_index)
assign a filter index to an agent
std::unordered_map< ActorId, int > _mapped_vehicles_id
std::unordered_map< ActorId, int > _mapped_walkers_id
mapping Id
bool RemoveAgent(ActorId id)
remove an agent
std::weak_ptr< carla::client::detail::Simulator > _simulator
bool GetWalkerPosition(ActorId id, carla::geom::Location &location)
get the walker current location
float GetWalkerSpeed(ActorId id)
get the walker current transform
bool Load(const std::string &filename)
load navigation data
bool SetWalkerTarget(ActorId id, carla::geom::Location to)
set a new target point to go through a route with events
void SetSeed(unsigned int seed)
set the seed to use with random numbers
dtNavMesh * _nav_mesh
meshes
bool UpdateVehicles(std::vector< VehicleCollisionInfo > vehicles)
add/update/delete vehicles in crowd
std::unordered_map< int, ActorId > _mapped_by_index
bool SetWalkerDirectTarget(ActorId id, carla::geom::Location to)
bool SetWalkerLookAt(ActorId id, carla::geom::Location location)
make agent look at some location
void PauseAgent(ActorId id, bool pause)
set an agent as paused for the crowd
bool HasVehicleNear(ActorId id, float distance, carla::geom::Location direction)
return if the agent has a vehicle near (as neighbour)
bool GetWalkerTransform(ActorId id, carla::geom::Transform &trans)
get the walker current transform
bool GetRandomLocation(carla::geom::Location &location, dtQueryFilter *filter=nullptr) const
get a random location for navigation
bool IsWalkerAlive(ActorId id, bool &alive)
return if the agent has been killed by a vehicle
WalkerManager _walker_manager
walker manager for the route planning with events
bool GetAgentRoute(ActorId id, carla::geom::Location from, carla::geom::Location to, std::vector< carla::geom::Location > &path, std::vector< unsigned char > &area)
void SetPedestriansCrossFactor(float percentage)
set the probability that an agent could cross the roads in its path following
std::unordered_map< ActorId, float > _yaw_walkers
store walkers yaw angle from previous tick
bool AddWalker(ActorId id, carla::geom::Location from)
create a new walker
std::vector< uint8_t > _binary_mesh
double GetDeltaSeconds()
return the last delta seconds
bool SetWalkerDirectTargetIndex(int index, carla::geom::Location to)
void SetSimulator(std::weak_ptr< carla::client::detail::Simulator > simulator)
reference to the simulator to access API functions
dtNavMeshQuery * _nav_query
void CreateCrowd(void)
create the crowd object
bool AddOrUpdateVehicle(VehicleCollisionInfo &vehicle)
create a new vehicle in crowd to be avoided by walkers
float _probability_crossing
std::unordered_map< int, carla::geom::Vector3D > _walkers_blocked_position
saves the position of each actor at intervals and check if any is blocked
This file contains definitions of common data structures used in traffic manager.
struct to send info about vehicles to the crowd
carla::geom::BoundingBox bounding
carla::geom::Transform transform