17 template <
typename RangeT>
24 static auto GetSize(
const TArray<T> &Array)
30 template <
typename T,
typename RangeT,
typename FuncT>
35 for (
auto &&Item : Range)
37 Result.Emplace(TransformFunction(Item));
42 template <
typename T,
typename RangeT>
45 return TransformToTArray<T>(
46 std::forward<RangeT>(Range),
47 [](
auto &&Item) {
return T{Item}; });
53 : Super(ObjectInitializer) {}
58 carla::rpc::FromLongFString(XODRContent));
61 Map = std::move(*ResultMap);
69 auto Result =
Map->GetClosestWaypointOnRoad(Location);
76 if (ApproxDistance < 1.0f)
78 UE_LOG(LogCarla, Error, TEXT(
"GenerateWaypoints: Please provide an ApproxDistance greater than 1 centimetre."));
83 return TransformToTArray<FWaypoint>(
Map->GenerateWaypoints(ApproxDistance / 1e2f));
90 return TransformToTArray<FWaypointConnection>(
Map->GenerateTopology(), [](
auto &&Item) {
91 return FWaypointConnection{FWaypoint{Item.first}, FWaypoint{Item.second}};
99 return TransformToTArray<FWaypoint>(
Map->GenerateWaypointsOnRoadEntries());
110 return TransformToTArray<FVector>(Waypoints, [
this](
auto &&Waypoint) {
125 return TransformToTArray<FTransform>(Waypoints, [
this](
auto &&Waypoint) {
134 UE_LOG(LogCarla, Error, TEXT(
"GetNext: Please provide a Distance greater than 1 centimetre."));
139 return TransformToTArray<FWaypoint>(
Map->GetNext(Waypoint.
Waypoint, Distance / 1e2f));
TOptional< carla::road::Map > Map
TArray< FWaypointConnection > GenerateTopology() const
Generate the minimum set of waypoints that define the topology of this map.
bool Load(const FString &XODRContent)
Load this map with an OpenDrive (XODR) file.
TArray< FWaypoint > GenerateWaypointsOnRoadEntries() const
Generate waypoints on each lane at the start of each road.
bool HasMap() const
Return whether this map has been initialized.
TArray< FVector > ComputeLocations(const TArray< FWaypoint > &Waypoints) const
Compute the locations of an array of waypoints.
TArray< FTransform > ComputeTransforms(const TArray< FWaypoint > &Waypoints) const
Compute the transforms of an array of waypoints.
FVector ComputeLocation(FWaypoint Waypoint) const
Compute the location of a waypoint.
FTransform ComputeTransform(FWaypoint Waypoint) const
Compute the transform of a waypoint.
TArray< FWaypoint > GetNext(FWaypoint Waypoint, float Distance=100.0f) const
Return the list of waypoints at a given distance such that a vehicle at waypoint could drive to.
FWaypoint GetClosestWaypointOnRoad(FVector Location, bool &Success) const
Given a location, return the closest point on the centre of a lane.
TArray< FWaypoint > GenerateWaypoints(float ApproxDistance=100.0f) const
Generate waypoints all over the map at an approximated distance.
UOpenDriveMap(const FObjectInitializer &ObjectInitializer)
static boost::optional< road::Map > Load(const std::string &opendrive)
static auto GetSize(const RangeT &Range)
static TArray< T > TransformToTArray(RangeT &&Range, FuncT &&TransformFunction)
carla::road::element::Waypoint Waypoint