CARLA
Loading...
Searching...
No Matches
BehaviorAgent.h
Go to the documentation of this file.
1// Copyright (c) 2018-2020 CVC.
2//
3// This work is licensed under the terms of the MIT license.
4// For a copy, see <https://opensource.org/licenses/MIT>.
5
6#pragma once
7
8#include "carla/Memory.h"
12
13namespace carla {
14
15namespace client {
16 class Actor;
17 class ActorList;
18 class Map;
19 class Vehicle;
20 class Waypoint;
21} // namespace client
22
23namespace agents {
24namespace navigation {
25
26 class GlobalRoutePlanner;
27
28 /// Behavior-driven navigation agent. Mirrors
29 /// agents.navigation.behavior_agent.BehaviorAgent in the Python API.
30 class BehaviorAgent : public BasicAgent {
31 public:
33
35 Behavior behavior = Behavior::Normal,
36 const Options &opts = BasicAgent::DefaultOptions(),
37 SharedPtr<client::Map> map = nullptr,
38 SharedPtr<GlobalRoutePlanner> grp = nullptr);
39
40 /// Returns true if the agent is affected by a traffic light.
42
43 /// Execute one step of navigation. The bool overload mirrors the Python
44 /// `run_step(debug=False)` signature.
45 rpc::VehicleControl RunStep(bool debug);
46
47 /// Polymorphic entry point: keeps dispatch through `BasicAgent*` correct.
48 rpc::VehicleControl RunStep() override { return RunStep(false); }
49
50 /// Build an emergency-stop control: throttle=0, brake=_max_brake,
51 /// hand_brake=false, steer left untouched (default 0).
53
54 private:
55 /// Refresh cached scene information consumed by RunStep.
56 void UpdateInformation();
57
58 /// Tailgating-avoidance lane change, called from CollisionAndCarAvoidManager.
60
61 /// Detect collision/car-avoidance opportunities ahead.
63
64 /// Detect pedestrians ahead.
66
67 /// Car-following control law applied when there is a vehicle in front.
69 float distance,
70 bool debug = false);
71
74 float _speed = 0.0f; // km/h
75 float _speed_limit = 0.0f; // km/h
76 float _min_speed = 5.0f; // km/h
80 };
81
82} // namespace navigation
83} // namespace agents
84} // namespace carla
float distance
C++ port of agents.navigation.basic_agent.BasicAgent.
Definition BasicAgent.h:44
static Options DefaultOptions()
Out-of-line default factory; see LocalPlanner::DefaultOptions().
Definition BasicAgent.h:171
Behavior-driven navigation agent.
rpc::VehicleControl CarFollowingManager(SharedPtr< client::Actor > vehicle, float distance, bool debug=false)
Car-following control law applied when there is a vehicle in front.
rpc::VehicleControl EmergencyStop() const
Build an emergency-stop control: throttle=0, brake=_max_brake, hand_brake=false, steer left untouched...
VehicleObstacle PedestrianAvoidManager(SharedPtr< client::Waypoint > waypoint)
Detect pedestrians ahead.
rpc::VehicleControl RunStep() override
Polymorphic entry point: keeps dispatch through BasicAgent* correct.
VehicleObstacle CollisionAndCarAvoidManager(SharedPtr< client::Waypoint > waypoint)
Detect collision/car-avoidance opportunities ahead.
void Tailgating(SharedPtr< client::Waypoint > waypoint)
Tailgating-avoidance lane change, called from CollisionAndCarAvoidManager.
bool TrafficLightManager()
Returns true if the agent is affected by a traffic light.
SharedPtr< client::Waypoint > _incoming_waypoint
void UpdateInformation()
Refresh cached scene information consumed by RunStep.
RoadOption
Topological direction emitted by the planners.
carla::SharedPtr< cc::Actor > Actor
carla::SharedPtr< cc::ActorList > ActorList
Definition ALSM.h:35
This file contains definitions of common data structures used in traffic manager.
std::shared_ptr< T > SharedPtr
Definition Memory.h:15
Parameter set consumed by BehaviorAgent.