CARLA
 
载入中...
搜索中...
未找到
OpenDriveMap.h
浏览该文件的文档.
1// Copyright (c) 2019 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
10#include <carla/road/Map.h>
12
13#include "OpenDriveMap.generated.h"
14
15USTRUCT(BlueprintType)
16struct CARLA_API FWaypoint
17{
18 GENERATED_BODY()
19
20 carla::road::element::Waypoint Waypoint;
21};
22
23USTRUCT(BlueprintType)
24struct CARLA_API FWaypointConnection
25{
26 GENERATED_BODY()
27
28 UPROPERTY(BlueprintReadWrite)
29 FWaypoint Start;
30
31 UPROPERTY(BlueprintReadWrite)
33};
34
35/// 将 CARLA OpenDrive API 公开给蓝图的辅助类。
36UCLASS(BlueprintType, Blueprintable)
37class CARLA_API UOpenDriveMap : public UObject
38{
39 GENERATED_BODY()
40
41public:
42
43 UOpenDriveMap(const FObjectInitializer &ObjectInitializer);
44
45 /// 返回此映射是否已初始化。
46 UFUNCTION(BlueprintCallable)
47 bool HasMap() const
48 {
49 return Map.IsSet();
50 }
51
52 /// 使用OpenDrive(XODR)文件加载此映射。
53 UFUNCTION(BlueprintCallable)
54 bool Load(const FString &XODRContent);
55
56 /// 给定一个位置,返回车道中心最近的点。
57 UFUNCTION(BlueprintCallable)
58 FWaypoint GetClosestWaypointOnRoad(FVector Location, bool &Success) const;
59
60 /// 在地图上以近似距离生成航路点。
61 UFUNCTION(BlueprintCallable)
62 TArray<FWaypoint> GenerateWaypoints(float ApproxDistance = 100.0f) const;
63
64 /// 生成定义此拓扑的最小航路点集地图。航点位于每条车道的入口处。
65 UFUNCTION(BlueprintCallable)
66 TArray<FWaypointConnection> GenerateTopology() const;
67
68 /// 在每条道路的起点,在每条车道上生成航点。
69 UFUNCTION(BlueprintCallable)
70 TArray<FWaypoint> GenerateWaypointsOnRoadEntries() const;
71
72 /// 计算航点的位置。
73 UFUNCTION(BlueprintCallable)
74 FVector ComputeLocation(FWaypoint Waypoint) const;
75
76 /// 计算航点数组的位置。
77 UFUNCTION(BlueprintCallable)
78 TArray<FVector> ComputeLocations(const TArray<FWaypoint> &Waypoints) const;
79
80 /// 计算航点的变换。x轴指向该航点的道路方向。
81 UFUNCTION(BlueprintCallable)
82 FTransform ComputeTransform(FWaypoint Waypoint) const;
83
84 /// 计算航点数组的变换。
85 UFUNCTION(BlueprintCallable)
86 TArray<FTransform> ComputeTransforms(const TArray<FWaypoint> &Waypoints) const;
87
88 /// 返回给定距离上的航点列表,以便位于航点的车辆可以行驶得到。
89 UFUNCTION(BlueprintCallable)
90 TArray<FWaypoint> GetNext(FWaypoint Waypoint, float Distance = 100.0f) const;
91
92private:
93
94 TOptional<carla::road::Map> Map;
95};
地图类的前向声明,用于在LaneInvasionSensor类中可能的引用。
将 CARLA OpenDrive API 公开给蓝图的辅助类。
TOptional< carla::road::Map > Map
CARLA模拟器的主命名空间。
Definition Carla.cpp:139