140 std::vector<carla::geom::Location> path;
141 std::vector<unsigned char> area;
154 info.
route.reserve(path.size());
156 for (
unsigned int i=0; i<path.size(); ++i) {
175 previous_area = area[i];
256 while (pos < info.
route.size()) {
258 location = info.
route[pos].location;
274 return boost::variant2::visit(visitor, rp.
event);
278 static bool AlreadyCalculated =
false;
279 if (AlreadyCalculated)
return;
285 std::vector<carla::rpc::Actor> actors =
_simulator.lock()->GetAllTheActorsInTheEpisode();
286 for (
auto actor : actors) {
289 if (actor.description.id ==
"traffic.traffic_light") {
294 std::vector<SharedPtr<carla::client::Waypoint>> list = tl->
GetStopWaypoints();
295 for (
auto &way : list) {
301 AlreadyCalculated =
true;
308 float max_distance) {
309 float min_dist = std::numeric_limits<float>::infinity();
313 if (dist < min_dist) {
319 if (max_distance < 0.0f || min_dist <= max_distance * max_distance) {
std::vector< WalkerRoutePoint > route
void SetNav(Navigation *nav)
assign the navigation module
bool GetWalkerNextPoint(ActorId id, carla::geom::Location &location)
get the next point in the route
void GetAllTrafficLightWaypoints()
bool GetWalkerPosition(ActorId id, carla::geom::Location &location)
get the walker current location
std::weak_ptr< carla::client::detail::Simulator > _simulator
float SquaredLength() const
void PauseAgent(ActorId id, bool pause)
set an agent as paused for the crowd
boost::shared_ptr< T > SharedPtr
Use this SharedPtr (boost::shared_ptr) to keep compatibility with boost::python, but it would be nice...
This file contains definitions of common data structures used in traffic manager. ...
EventResult
result of an event
std::vector< SharedPtr< Waypoint > > GetStopWaypoints() const
bool RemoveWalker(ActorId id)
remove a walker route
std::vector< std::pair< SharedPtr< carla::client::TrafficLight >, carla::geom::Location > > _traffic_lights
bool SetWalkerNextPoint(ActorId id)
set the next point in the route
carla::geom::Location from
SharedPtr< carla::client::TrafficLight > GetTrafficLightAffecting(carla::geom::Location UnrealPos, float max_distance=-1.0f)
return the trafficlight affecting that position
event to pause and check for near vehicles
bool SetWalkerDirectTarget(ActorId id, carla::geom::Location to)
std::unordered_map< ActorId, WalkerInfo > _walkers
EventResult ExecuteEvent(ActorId id, WalkerInfo &info, double delta)
SharedPtr< Actor > GetActor(ActorId id) const
Find actor by id, return nullptr if not found.
bool GetWalkerCrosswalkEnd(ActorId id, carla::geom::Location &location)
get the point in the route that end current crosswalk
bool GetAgentRoute(ActorId id, carla::geom::Location from, carla::geom::Location to, std::vector< carla::geom::Location > &path, std::vector< unsigned char > &area)
bool GetRandomLocation(carla::geom::Location &location, dtQueryFilter *filter=nullptr) const
get a random location for navigation
bool Update(double delta)
update all routes
bool SetWalkerRoute(ActorId id)
set a new route from its current position
auto DistanceSquared(const Location &loc) const
empty event that just ignores
bool AddWalker(ActorId id)
create a new walker route
Manage the pedestrians navigation, using the Recast & Detour library for low level calculations...
void SetSimulator(std::weak_ptr< carla::client::detail::Simulator > simulator)
reference to the simulator to access API functions
unsigned int currentIndex