|
CARLA
|
C++ port of agents.navigation.constant_velocity_agent.ConstantVelocityAgent. More...
#include <ConstantVelocityAgent.h>
Inheritance diagram for carla::agents::navigation::ConstantVelocityAgent:Classes | |
| struct | ConstantOptions |
Public Member Functions | |
| ConstantVelocityAgent (SharedPtr< client::Vehicle > vehicle, float target_speed_kmh=20.0f, const ConstantOptions &opts=DefaultConstantOptions(), SharedPtr< client::Map > map=nullptr, SharedPtr< GlobalRoutePlanner > grp=nullptr) | |
| void | DestroySensor () |
| Tear down the collision sensor (called from the destructor too). | |
| void | RestartConstantVelocity () |
Re-enable constant velocity at the current _target_speed_ms. | |
| rpc::VehicleControl | RunStep () override |
| void | SetTargetSpeed (float speed_kmh) |
Hides BasicAgent::SetTargetSpeed; converts km/h to m/s for the internal _target_speed_ms and forwards to the planner. | |
| void | StopConstantVelocity () |
| Disables constant velocity mode and stamps the stop time. | |
| ~ConstantVelocityAgent () override | |
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 |
Static Public Member Functions | |
| static ConstantOptions | DefaultConstantOptions () |
| Out-of-line default factory; see LocalPlanner::DefaultOptions(). | |
Static Public Member Functions inherited from carla::agents::navigation::BasicAgent | |
| static Options | DefaultOptions () |
| Out-of-line default factory; see LocalPlanner::DefaultOptions(). | |
Private Member Functions | |
| void | SetCollisionSensor () |
| void | SetConstantVelocity (float speed_ms) |
Private Attributes | |
| SharedPtr< client::Sensor > | _collision_sensor |
| double | _constant_velocity_stop_time |
| bool | _has_stop_timestamp |
| bool | _is_constant_velocity_active |
| float | _restart_time |
| float | _target_speed_ms |
| bool | _use_basic_behavior |
Additional Inherited Members | |
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 |
C++ port of agents.navigation.constant_velocity_agent.ConstantVelocityAgent.
Drives the ego at a fixed velocity, using BasicAgent's planner just to keep the wheels rotating. A collision sensor is attached on construction and a collision flips the agent into a "stopped" state.
Definition at line 32 of file ConstantVelocityAgent.h.
| carla::agents::navigation::ConstantVelocityAgent::ConstantVelocityAgent | ( | SharedPtr< client::Vehicle > | vehicle, |
| float | target_speed_kmh = 20.0f, |
||
| const ConstantOptions & | opts = DefaultConstantOptions(), |
||
| SharedPtr< client::Map > | map = nullptr, |
||
| SharedPtr< GlobalRoutePlanner > | grp = nullptr |
||
| ) |
Definition at line 30 of file ConstantVelocityAgent.cpp.
References _target_speed_ms, SetCollisionSensor(), and SetConstantVelocity().
|
override |
Definition at line 49 of file ConstantVelocityAgent.cpp.
References DestroySensor().
|
inlinestatic |
Out-of-line default factory; see LocalPlanner::DefaultOptions().
Definition at line 84 of file ConstantVelocityAgent.h.
Referenced by TEST().
| void carla::agents::navigation::ConstantVelocityAgent::DestroySensor | ( | ) |
Tear down the collision sensor (called from the destructor too).
Definition at line 159 of file ConstantVelocityAgent.cpp.
References _collision_sensor.
Referenced by ~ConstantVelocityAgent().
| void carla::agents::navigation::ConstantVelocityAgent::RestartConstantVelocity | ( | ) |
Re-enable constant velocity at the current _target_speed_ms.
Definition at line 66 of file ConstantVelocityAgent.cpp.
References _is_constant_velocity_active, _target_speed_ms, and SetConstantVelocity().
Referenced by RunStep().
|
overridevirtual |
Reimplemented from carla::agents::navigation::BasicAgent.
Definition at line 75 of file ConstantVelocityAgent.cpp.
References carla::agents::navigation::BasicAgent::_base_tlight_threshold, carla::agents::navigation::BasicAgent::_base_vehicle_threshold, _constant_velocity_stop_time, _has_stop_timestamp, _is_constant_velocity_active, carla::agents::navigation::BasicAgent::_local_planner, _restart_time, _target_speed_ms, _use_basic_behavior, carla::agents::navigation::BasicAgent::_vehicle, carla::agents::navigation::BasicAgent::_world, carla::agents::navigation::BasicAgent::AffectedByTrafficLight(), RestartConstantVelocity(), carla::agents::navigation::BasicAgent::RunStep(), SetConstantVelocity(), and carla::agents::navigation::BasicAgent::VehicleObstacleDetected().
|
private |
Definition at line 138 of file ConstantVelocityAgent.cpp.
References _collision_sensor, carla::agents::navigation::BasicAgent::_vehicle, carla::agents::navigation::BasicAgent::_world, and StopConstantVelocity().
Referenced by ConstantVelocityAgent().
|
private |
Definition at line 71 of file ConstantVelocityAgent.cpp.
References carla::agents::navigation::BasicAgent::_vehicle.
Referenced by ConstantVelocityAgent(), RestartConstantVelocity(), and RunStep().
| void carla::agents::navigation::ConstantVelocityAgent::SetTargetSpeed | ( | float | speed_kmh | ) |
Hides BasicAgent::SetTargetSpeed; converts km/h to m/s for the internal _target_speed_ms and forwards to the planner.
Definition at line 53 of file ConstantVelocityAgent.cpp.
References carla::agents::navigation::BasicAgent::_local_planner, and _target_speed_ms.
| void carla::agents::navigation::ConstantVelocityAgent::StopConstantVelocity | ( | ) |
Disables constant velocity mode and stamps the stop time.
The agent will sit idle until restart_time has elapsed (then auto-restart) or RestartConstantVelocity is called manually.
Definition at line 58 of file ConstantVelocityAgent.cpp.
References _constant_velocity_stop_time, _has_stop_timestamp, _is_constant_velocity_active, carla::agents::navigation::BasicAgent::_vehicle, and carla::agents::navigation::BasicAgent::_world.
Referenced by SetCollisionSensor().
|
private |
Definition at line 80 of file ConstantVelocityAgent.h.
Referenced by DestroySensor(), and SetCollisionSensor().
|
private |
Definition at line 77 of file ConstantVelocityAgent.h.
Referenced by RunStep(), and StopConstantVelocity().
|
private |
Definition at line 78 of file ConstantVelocityAgent.h.
Referenced by RunStep(), and StopConstantVelocity().
|
private |
Definition at line 76 of file ConstantVelocityAgent.h.
Referenced by RestartConstantVelocity(), RunStep(), and StopConstantVelocity().
|
private |
Definition at line 75 of file ConstantVelocityAgent.h.
Referenced by RunStep().
|
private |
Definition at line 74 of file ConstantVelocityAgent.h.
Referenced by ConstantVelocityAgent(), RestartConstantVelocity(), RunStep(), and SetTargetSpeed().
|
private |
Definition at line 73 of file ConstantVelocityAgent.h.
Referenced by RunStep().