CARLA
Loading...
Searching...
No Matches
Classes | Typedefs | Enumerations | Functions
carla::agents::navigation Namespace Reference

Classes

class  BasicAgent
 C++ port of agents.navigation.basic_agent.BasicAgent. More...
 
class  BehaviorAgent
 Behavior-driven navigation agent. More...
 
struct  BehaviorParameters
 Parameter set consumed by BehaviorAgent. More...
 
class  ConstantVelocityAgent
 C++ port of agents.navigation.constant_velocity_agent.ConstantVelocityAgent. More...
 
class  GlobalRoutePlanner
 C++ port of agents.navigation.global_route_planner.GlobalRoutePlanner. More...
 
class  LocalPlanner
 LocalPlanner reproduces agents.navigation.local_planner.LocalPlanner. More...
 
class  PIDLateralController
 Lateral PID controller. More...
 
class  PIDLongitudinalController
 Longitudinal PID controller. More...
 
class  VehiclePIDController
 Combined longitudinal + lateral PID controller. More...
 

Typedefs

using BgPoint = bg::model::d2::point_xy< double >
 
using BgPolygon = bg::model::polygon< BgPoint >
 
using LaneChange = road::element::LaneMarking::LaneChange
 
using LaneType = road::Lane::LaneType
 

Enumerations

enum class  RoadOption : int8_t {
  Void = -1 , Left = 1 , Right = 2 , Straight = 3 ,
  LaneFollow = 4 , ChangeLaneLeft = 5 , ChangeLaneRight = 6
}
 Topological direction emitted by the planners. More...
 

Functions

float ComputeDistance (const geom::Location &a, const geom::Location &b)
 Euclidean distance between two locations (matches numpy's regularised version that adds an epsilon to avoid 0).
 
std::pair< float, float > ComputeMagnitudeAngle (const geom::Location &target, const geom::Location &current, float orientation_deg)
 Returns the (distance, angle in degrees) from current to target relative to a forward orientation orientation_deg in degrees.
 
float DistanceVehicle (SharedPtr< client::Waypoint > waypoint, const geom::Transform &vehicle_transform)
 2-D distance between a waypoint and a vehicle transform.
 
void DrawWaypoints (SharedPtr< client::World > world, const std::vector< SharedPtr< client::Waypoint > > &waypoints, float z=0.5f)
 Draw the supplied waypoints in the world for a fixed lifetime.
 
float GetSpeed (SharedPtr< client::Actor > actor)
 Compute speed of an actor in km/h.
 
geom::Location GetTrafficLightTriggerLocation (SharedPtr< client::TrafficLight > traffic_light)
 Compute the world-space trigger location of a traffic light, mirroring the helper in agents.tools.misc.get_trafficlight_trigger_location.
 
bool IsWithinDistance (const geom::Transform &target, const geom::Transform &reference, float max_distance, std::optional< std::pair< float, float > > angle_interval=std::nullopt)
 Returns true when target is within max_distance of reference.
 
float Positive (float v)
 Clamp v at zero. Inline because it's tiny.
 
std::array< float, 3 > UnitVector (const geom::Location &a, const geom::Location &b)
 Unit vector going from a to b, including the z component.
 

Typedef Documentation

◆ BgPoint

using carla::agents::navigation::BgPoint = typedef bg::model::d2::point_xy<double>

Definition at line 43 of file BasicAgent.cpp.

◆ BgPolygon

using carla::agents::navigation::BgPolygon = typedef bg::model::polygon<BgPoint>

Definition at line 44 of file BasicAgent.cpp.

◆ LaneChange

Definition at line 47 of file BasicAgent.cpp.

◆ LaneType

Definition at line 46 of file BasicAgent.cpp.

Enumeration Type Documentation

◆ RoadOption

enum class carla::agents::navigation::RoadOption : int8_t
strong

Topological direction emitted by the planners.

Mirrors agents.navigation.local_planner.RoadOption from PythonAPI.

Enumerator
Void 
Left 
Right 
Straight 
LaneFollow 
ChangeLaneLeft 
ChangeLaneRight 

Definition at line 16 of file agents/navigation/Types.h.

Function Documentation

◆ ComputeDistance()

float carla::agents::navigation::ComputeDistance ( const geom::Location &  a,
const geom::Location &  b 
)

Euclidean distance between two locations (matches numpy's regularised version that adds an epsilon to avoid 0).

Definition at line 150 of file Misc.cpp.

References carla::geom::Vector3D::x, x, carla::geom::Vector3D::y, y, carla::geom::Vector3D::z, and z.

Referenced by TEST(), and carla::agents::navigation::BasicAgent::VehicleObstacleDetected().

◆ ComputeMagnitudeAngle()

std::pair< float, float > carla::agents::navigation::ComputeMagnitudeAngle ( const geom::Location &  target,
const geom::Location &  current,
float  orientation_deg 
)

Returns the (distance, angle in degrees) from current to target relative to a forward orientation orientation_deg in degrees.

Definition at line 109 of file Misc.cpp.

References carla::geom::Math::ToDegrees(), carla::geom::Math::ToRadians(), carla::geom::Vector3D::x, and carla::geom::Vector3D::y.

Referenced by TEST(), and TEST().

◆ DistanceVehicle()

float carla::agents::navigation::DistanceVehicle ( SharedPtr< client::Waypoint >  waypoint,
const geom::Transform &  vehicle_transform 
)

2-D distance between a waypoint and a vehicle transform.

Definition at line 130 of file Misc.cpp.

References carla::geom::Transform::location, carla::geom::Vector3D::x, and carla::geom::Vector3D::y.

◆ DrawWaypoints()

void carla::agents::navigation::DrawWaypoints ( SharedPtr< client::World >  world,
const std::vector< SharedPtr< client::Waypoint > > &  waypoints,
float  z 
)

Draw the supplied waypoints in the world for a fixed lifetime.

Definition at line 159 of file Misc.cpp.

References carla::geom::Math::ToRadians(), carla::geom::Vector3D::x, carla::geom::Vector3D::y, carla::geom::Vector3D::z, and z.

Referenced by carla::agents::navigation::LocalPlanner::RunStep().

◆ GetSpeed()

float carla::agents::navigation::GetSpeed ( SharedPtr< client::Actor >  actor)

◆ GetTrafficLightTriggerLocation()

geom::Location carla::agents::navigation::GetTrafficLightTriggerLocation ( SharedPtr< client::TrafficLight >  traffic_light)

◆ IsWithinDistance()

bool carla::agents::navigation::IsWithinDistance ( const geom::Transform &  target,
const geom::Transform &  reference,
float  max_distance,
std::optional< std::pair< float, float > >  angle_interval = std::nullopt 
)

Returns true when target is within max_distance of reference.

When angle_interval is provided, the angle (in degrees) between the reference's forward vector and the vector reference -> target must lie in the open interval (min, max).

Definition at line 78 of file Misc.cpp.

References carla::geom::Transform::GetForwardVector(), carla::geom::Transform::location, carla::geom::Math::ToDegrees(), carla::geom::Vector3D::x, and carla::geom::Vector3D::y.

Referenced by carla::agents::navigation::BasicAgent::AffectedByTrafficLight(), TEST(), TEST(), TEST(), and carla::agents::navigation::BasicAgent::VehicleObstacleDetected().

◆ Positive()

float carla::agents::navigation::Positive ( float  v)
inline

Clamp v at zero. Inline because it's tiny.

Definition at line 74 of file Misc.h.

Referenced by carla::agents::navigation::BehaviorAgent::CarFollowingManager(), and TEST().

◆ UnitVector()

std::array< float, 3 > carla::agents::navigation::UnitVector ( const geom::Location &  a,
const geom::Location &  b 
)

Unit vector going from a to b, including the z component.

Definition at line 139 of file Misc.cpp.

References carla::geom::Vector3D::x, x, carla::geom::Vector3D::y, y, carla::geom::Vector3D::z, and z.

Referenced by carla::agents::navigation::GlobalRoutePlanner::BuildGraph(), and TEST().