|
CARLA
|
Behavior-driven navigation agent. More...
#include <BehaviorAgent.h>
Inheritance diagram for carla::agents::navigation::BehaviorAgent:Public Types | |
| enum class | Behavior { Cautious , Normal , Aggressive } |
Public Member Functions | |
| BehaviorAgent (SharedPtr< client::Vehicle > vehicle, Behavior behavior=Behavior::Normal, const Options &opts=BasicAgent::DefaultOptions(), SharedPtr< client::Map > map=nullptr, SharedPtr< GlobalRoutePlanner > grp=nullptr) | |
| rpc::VehicleControl | EmergencyStop () const |
| Build an emergency-stop control: throttle=0, brake=_max_brake, hand_brake=false, steer left untouched (default 0). | |
| rpc::VehicleControl | RunStep () override |
Polymorphic entry point: keeps dispatch through BasicAgent* correct. | |
| rpc::VehicleControl | RunStep (bool debug) |
| Execute one step of navigation. | |
| bool | TrafficLightManager () |
| Returns true if the agent is affected by a traffic light. | |
Public Member Functions inherited from carla::agents::navigation::BasicAgent | |
| rpc::VehicleControl | AddEmergencyStop (rpc::VehicleControl c) const |
| Overwrites throttle/brake to perform an emergency stop. | |
| BasicAgent (SharedPtr< client::Vehicle > vehicle, float target_speed_kmh=20.0f, const Options &options=DefaultOptions(), SharedPtr< client::Map > map=nullptr, SharedPtr< GlobalRoutePlanner > grp=nullptr) | |
| bool | Done () const |
| void | FollowSpeedLimits (bool value=true) |
| GlobalRoutePlanner * | GetGlobalPlanner () |
| LocalPlanner * | GetLocalPlanner () |
| void | IgnoreStopSigns (bool active=true) |
| void | IgnoreTrafficLights (bool active=true) |
| void | IgnoreVehicles (bool active=true) |
| void | LaneChange (const std::string &direction, float same_lane_time=0.0f, float other_lane_time=0.0f, float lane_change_time=2.0f) |
| Replaces the current plan with one that performs a lane change. | |
| void | SetDestination (const geom::Location &end, std::optional< geom::Location > start=std::nullopt) |
Computes a route from start (or the current target waypoint) to end and forwards it to the local planner. | |
| void | SetGlobalPlan (const std::vector< LocalPlanner::PlanItem > &plan, bool stop_waypoint_creation=true, bool clean_queue=true) |
| void | SetOffset (float offset) |
| void | SetTargetSpeed (float speed_kmh) |
| std::vector< LocalPlanner::PlanItem > | TraceRoute (SharedPtr< client::Waypoint > start, SharedPtr< client::Waypoint > end) |
| virtual | ~BasicAgent ()=default |
Private Member Functions | |
| rpc::VehicleControl | CarFollowingManager (SharedPtr< client::Actor > vehicle, float distance, bool debug=false) |
| Car-following control law applied when there is a vehicle in front. | |
| VehicleObstacle | CollisionAndCarAvoidManager (SharedPtr< client::Waypoint > waypoint) |
| Detect collision/car-avoidance opportunities ahead. | |
| VehicleObstacle | PedestrianAvoidManager (SharedPtr< client::Waypoint > waypoint) |
| Detect pedestrians ahead. | |
| void | Tailgating (SharedPtr< client::Waypoint > waypoint) |
| Tailgating-avoidance lane change, called from CollisionAndCarAvoidManager. | |
| void | UpdateInformation () |
| Refresh cached scene information consumed by RunStep. | |
Private Attributes | |
| BehaviorParameters | _behavior |
| RoadOption | _direction = RoadOption::LaneFollow |
| RoadOption | _incoming_direction = RoadOption::LaneFollow |
| SharedPtr< client::Waypoint > | _incoming_waypoint |
| int | _look_ahead_steps = 0 |
| float | _min_speed = 5.0f |
| float | _speed = 0.0f |
| float | _speed_limit = 0.0f |
Additional Inherited Members | |
Static Public Member Functions inherited from carla::agents::navigation::BasicAgent | |
| static Options | DefaultOptions () |
| Out-of-line default factory; see LocalPlanner::DefaultOptions(). | |
Protected Member Functions inherited from carla::agents::navigation::BasicAgent | |
| std::pair< bool, SharedPtr< client::TrafficLight > > | AffectedByTrafficLight (SharedPtr< client::ActorList > lights=nullptr, std::optional< float > max_distance=std::nullopt) |
Returns (affected, light) similar to Python _affected_by_traffic_light. | |
| std::vector< LocalPlanner::PlanItem > | GenerateLaneChangePath (SharedPtr< client::Waypoint > waypoint, const std::string &direction="left", float distance_same_lane=10.0f, float distance_other_lane=25.0f, float lane_change_distance=25.0f, bool check=true, int lane_changes=1, float step_distance=2.0f) |
Mirrors Python _generate_lane_change_path. | |
| VehicleObstacle | VehicleObstacleDetected (SharedPtr< client::ActorList > vehicles=nullptr, std::optional< float > max_distance=std::nullopt, float up_angle_th=90.0f, float low_angle_th=0.0f, int lane_offset=0) |
Mirrors Python _vehicle_obstacle_detected. | |
Protected Attributes inherited from carla::agents::navigation::BasicAgent | |
| float | _base_tlight_threshold |
| float | _base_vehicle_threshold |
| SharedPtr< GlobalRoutePlanner > | _global_planner |
| bool | _ignore_stop_signs |
| bool | _ignore_traffic_lights |
| bool | _ignore_vehicles |
| SharedPtr< client::TrafficLight > | _last_traffic_light |
| SharedPtr< client::ActorList > | _lights_list |
| std::unordered_map< uint32_t, SharedPtr< client::Waypoint > > | _lights_map |
| std::unique_ptr< LocalPlanner > | _local_planner |
| SharedPtr< client::Map > | _map |
| float | _max_brake |
| float | _offset |
| float | _sampling_resolution |
| float | _speed_ratio |
| float | _target_speed |
| bool | _use_bbs_detection |
| SharedPtr< client::Vehicle > | _vehicle |
| SharedPtr< client::World > | _world |
Behavior-driven navigation agent.
Mirrors agents.navigation.behavior_agent.BehaviorAgent in the Python API.
Definition at line 30 of file BehaviorAgent.h.
|
strong |
| Enumerator | |
|---|---|
| Cautious | |
| Normal | |
| Aggressive | |
Definition at line 32 of file BehaviorAgent.h.
| carla::agents::navigation::BehaviorAgent::BehaviorAgent | ( | SharedPtr< client::Vehicle > | vehicle, |
| Behavior | behavior = Behavior::Normal, |
||
| const Options & | opts = BasicAgent::DefaultOptions(), |
||
| SharedPtr< client::Map > | map = nullptr, |
||
| SharedPtr< GlobalRoutePlanner > | grp = nullptr |
||
| ) |
Definition at line 59 of file BehaviorAgent.cpp.
References carla::agents::navigation::BasicAgent::_sampling_resolution.
|
private |
Car-following control law applied when there is a vehicle in front.
Definition at line 274 of file BehaviorAgent.cpp.
References _behavior, carla::agents::navigation::BasicAgent::_local_planner, _min_speed, _speed, _speed_limit, distance, carla::agents::navigation::GetSpeed(), carla::agents::navigation::BehaviorParameters::max_speed, carla::agents::navigation::Positive(), carla::agents::navigation::BehaviorParameters::safety_time, carla::agents::navigation::BehaviorParameters::speed_decrease, and carla::agents::navigation::BehaviorParameters::speed_lim_dist.
Referenced by RunStep().
|
private |
Detect collision/car-avoidance opportunities ahead.
Definition at line 189 of file BehaviorAgent.cpp.
References _behavior, _direction, _speed, _speed_limit, carla::agents::navigation::BasicAgent::_world, carla::agents::navigation::BasicAgent::VehicleObstacle::affected, carla::agents::navigation::ChangeLaneLeft, carla::agents::navigation::ChangeLaneRight, carla::agents::navigation::LaneFollow, carla::agents::navigation::BehaviorParameters::min_proximity_threshold, carla::agents::navigation::BehaviorParameters::tailgate_counter, Tailgating(), and carla::agents::navigation::BasicAgent::VehicleObstacleDetected().
Referenced by RunStep().
| rpc::VehicleControl carla::agents::navigation::BehaviorAgent::EmergencyStop | ( | ) | const |
Build an emergency-stop control: throttle=0, brake=_max_brake, hand_brake=false, steer left untouched (default 0).
Definition at line 371 of file BehaviorAgent.cpp.
References carla::agents::navigation::BasicAgent::_max_brake, and carla::rpc::VehicleControl::throttle.
Referenced by RunStep().
|
private |
Detect pedestrians ahead.
Definition at line 234 of file BehaviorAgent.cpp.
References _behavior, _direction, _speed_limit, carla::agents::navigation::BasicAgent::_world, carla::agents::navigation::ChangeLaneLeft, carla::agents::navigation::ChangeLaneRight, carla::agents::navigation::BehaviorParameters::min_proximity_threshold, and carla::agents::navigation::BasicAgent::VehicleObstacleDetected().
Referenced by RunStep().
|
inlineoverridevirtual |
Polymorphic entry point: keeps dispatch through BasicAgent* correct.
Reimplemented from carla::agents::navigation::BasicAgent.
Definition at line 48 of file BehaviorAgent.h.
References RunStep().
Referenced by RunStep().
| rpc::VehicleControl carla::agents::navigation::BehaviorAgent::RunStep | ( | bool | debug | ) |
Execute one step of navigation.
The bool overload mirrors the Python run_step(debug=False) signature.
Definition at line 306 of file BehaviorAgent.cpp.
References _behavior, _incoming_direction, _incoming_waypoint, carla::agents::navigation::BasicAgent::_local_planner, carla::agents::navigation::BasicAgent::_map, _speed_limit, carla::agents::navigation::BasicAgent::_vehicle, carla::agents::navigation::BehaviorParameters::braking_distance, CarFollowingManager(), CollisionAndCarAvoidManager(), distance, EmergencyStop(), carla::agents::navigation::Left, carla::agents::navigation::BehaviorParameters::max_speed, PedestrianAvoidManager(), carla::agents::navigation::Right, carla::agents::navigation::BehaviorParameters::speed_lim_dist, carla::agents::navigation::BehaviorParameters::tailgate_counter, TrafficLightManager(), and UpdateInformation().
|
private |
Tailgating-avoidance lane change, called from CollisionAndCarAvoidManager.
Definition at line 110 of file BehaviorAgent.cpp.
References _behavior, carla::agents::navigation::BasicAgent::_local_planner, _speed, _speed_limit, carla::agents::navigation::BasicAgent::_world, carla::road::Lane::Driving, carla::agents::navigation::GetSpeed(), carla::agents::navigation::BehaviorParameters::min_proximity_threshold, carla::agents::navigation::BasicAgent::SetDestination(), carla::agents::navigation::BehaviorParameters::tailgate_counter, and carla::agents::navigation::BasicAgent::VehicleObstacleDetected().
Referenced by CollisionAndCarAvoidManager().
| bool carla::agents::navigation::BehaviorAgent::TrafficLightManager | ( | ) |
Returns true if the agent is affected by a traffic light.
Definition at line 99 of file BehaviorAgent.cpp.
References carla::agents::navigation::BasicAgent::_world, and carla::agents::navigation::BasicAgent::AffectedByTrafficLight().
Referenced by RunStep().
|
private |
Refresh cached scene information consumed by RunStep.
Definition at line 74 of file BehaviorAgent.cpp.
References _direction, _incoming_direction, _incoming_waypoint, carla::agents::navigation::BasicAgent::_local_planner, _look_ahead_steps, _speed, _speed_limit, carla::agents::navigation::BasicAgent::_vehicle, carla::agents::navigation::GetSpeed(), carla::agents::navigation::LaneFollow, and carla::agents::navigation::Void.
Referenced by RunStep().
|
private |
Definition at line 72 of file BehaviorAgent.h.
Referenced by CarFollowingManager(), CollisionAndCarAvoidManager(), PedestrianAvoidManager(), RunStep(), and Tailgating().
|
private |
Definition at line 77 of file BehaviorAgent.h.
Referenced by CollisionAndCarAvoidManager(), PedestrianAvoidManager(), and UpdateInformation().
|
private |
Definition at line 78 of file BehaviorAgent.h.
Referenced by RunStep(), and UpdateInformation().
|
private |
Definition at line 79 of file BehaviorAgent.h.
Referenced by RunStep(), and UpdateInformation().
|
private |
Definition at line 73 of file BehaviorAgent.h.
Referenced by UpdateInformation().
|
private |
Definition at line 76 of file BehaviorAgent.h.
Referenced by CarFollowingManager().
|
private |
Definition at line 74 of file BehaviorAgent.h.
Referenced by CarFollowingManager(), CollisionAndCarAvoidManager(), Tailgating(), and UpdateInformation().
|
private |
Definition at line 75 of file BehaviorAgent.h.
Referenced by CarFollowingManager(), CollisionAndCarAvoidManager(), PedestrianAvoidManager(), RunStep(), Tailgating(), and UpdateInformation().