CARLA
LocalizationUtils.h
Go to the documentation of this file.
1 // Copyright (c) 2020 Computer Vision Center (CVC) at the Universitat Autonoma
2 // de Barcelona (UAB).
3 //
4 // This work is licensed under the terms of the MIT license.
5 // For a copy, see <https://opensource.org/licenses/MIT>.
6 
7 #pragma once
8 
9 #include "carla/client/Actor.h"
10 #include "carla/client/ActorList.h"
11 #include "carla/client/Vehicle.h"
12 #include "carla/client/World.h"
13 #include "carla/geom/Location.h"
14 #include "carla/road/RoadTypes.h"
15 #include "carla/rpc/ActorId.h"
16 
20 
21 namespace carla {
22 namespace traffic_manager {
23 
24  namespace cc = carla::client;
25  namespace cg = carla::geom;
27  using ActorId = carla::ActorId;
28  using ActorIdSet = std::unordered_set<ActorId>;
29  using SimpleWaypointPtr = std::shared_ptr<SimpleWaypoint>;
30  using Buffer = std::deque<SimpleWaypointPtr>;
34 
35  /// Returns the cross product (z component value) between the vehicle's
36  /// heading vector and the vector along the direction to the next
37  /// target waypoint on the horizon.
38  float DeviationCrossProduct(const cg::Location &reference_location,
39  const cg::Vector3D &heading_vector,
40  const cg::Location &target_location);
41  /// Returns the dot product between the vehicle's heading vector and
42  /// the vector along the direction to the next target waypoint on the horizon.
43  float DeviationDotProduct(const cg::Location &reference_location,
44  const cg::Vector3D &heading_vector,
45  const cg::Location &target_location);
46 
47  // Function to add a waypoint to a path buffer and update waypoint tracking.
48  void PushWaypoint(ActorId actor_id, TrackTraffic& track_traffic,
49  Buffer& buffer, SimpleWaypointPtr& waypoint);
50 
51  // Function to remove a waypoint from a path buffer and update waypoint tracking.
52  void PopWaypoint(ActorId actor_id, TrackTraffic& track_traffic,
53  Buffer& buffer, bool front_or_back=true);
54 
55  /// Method to return the wayPoints from the waypoint Buffer by using target point distance
56  using TargetWPInfo = std::pair<SimpleWaypointPtr,uint64_t>;
57  TargetWPInfo GetTargetWaypoint(const Buffer& waypoint_buffer, const float& target_point_distance);
58 
59 } // namespace traffic_manager
60 } // namespace carla
TargetWPInfo GetTargetWaypoint(const Buffer &waypoint_buffer, const float &target_point_distance)
void PopWaypoint(ActorId actor_id, TrackTraffic &track_traffic, Buffer &buffer, bool front_or_back)
float DeviationDotProduct(const cg::Location &reference_location, const cg::Vector3D &heading_vector, const cg::Location &target_location)
Returns the dot product between the vehicle&#39;s heading vector and the vector along the direction to th...
rpc::ActorId ActorId
Definition: ActorId.h:18
boost::shared_ptr< T > SharedPtr
Use this SharedPtr (boost::shared_ptr) to keep compatibility with boost::python, but it would be nice...
Definition: Memory.h:20
This file contains definitions of common data structures used in traffic manager. ...
Definition: Carla.cpp:99
std::unordered_set< ActorId > ActorIdSet
void PushWaypoint(ActorId actor_id, TrackTraffic &track_traffic, Buffer &buffer, SimpleWaypointPtr &waypoint)
std::deque< std::shared_ptr< SimpleWaypoint > > Buffer
int32_t JuncId
Definition: RoadTypes.h:17
carla::SharedPtr< cc::Actor > Actor
carla::ActorId ActorId
float DeviationCrossProduct(const cg::Location &reference_location, const cg::Vector3D &heading_vector, const cg::Location &target_location)
Returns the cross product (z component value) between the vehicle&#39;s heading vector and the vector alo...
crd::JuncId GeoGridId
Definition: InMemoryMap.h:38
static const double MAP_RESOLUTION
Definition: Constants.h:97
std::shared_ptr< SimpleWaypoint > SimpleWaypointPtr
std::pair< SimpleWaypointPtr, uint64_t > TargetWPInfo
Method to return the wayPoints from the waypoint Buffer by using target point distance.
static const float INV_MAP_RESOLUTION
Definition: Constants.h:98