Removed RoadObject. Adding RoadInfoSignals.
This commit is contained in:
parent
e9e2015674
commit
2a7bb9e15a
|
@ -7,7 +7,7 @@
|
|||
#include "carla/opendrive/parser/ObjectParser.h"
|
||||
|
||||
#include "carla/road/MapBuilder.h"
|
||||
#include "carla/road/element/RoadObjectCrosswalk.h"
|
||||
#include "carla/road/element/RoadInfoCrosswalk.h"
|
||||
#include "carla/road/Road.h"
|
||||
|
||||
#include <pugixml/pugixml.hpp>
|
||||
|
|
|
@ -14,44 +14,40 @@ namespace carla {
|
|||
namespace opendrive {
|
||||
namespace parser {
|
||||
|
||||
using RoadID = uint32_t;
|
||||
using SignalID = uint32_t;
|
||||
using DependencyID = uint32_t;
|
||||
|
||||
template <typename T>
|
||||
static void AddValidity(
|
||||
pugi::xml_node parent_node,
|
||||
const std::string &node_name,
|
||||
const RoadID roadID,
|
||||
const SignalID &signalID,
|
||||
T &&function) {
|
||||
road::element::RoadInfoSignal* signal_reference,
|
||||
pugi::xml_node parent_node,
|
||||
const std::string &node_name,
|
||||
road::MapBuilder &map_builder) {
|
||||
for (pugi::xml_node validity_node = parent_node.child(node_name.c_str());
|
||||
validity_node;
|
||||
validity_node = validity_node.next_sibling("validity")) {
|
||||
const auto from_lane = static_cast<int16_t>(validity_node.attribute("fromLane").as_int());
|
||||
const auto to_lane = static_cast<int16_t>(validity_node.attribute("toLane").as_int());
|
||||
log_debug("Added validity to signal ", signalID, ":", from_lane, to_lane);
|
||||
function(roadID, signalID, from_lane, to_lane);
|
||||
const auto from_lane = validity_node.attribute("fromLane").as_int();
|
||||
const auto to_lane = validity_node.attribute("toLane").as_int();
|
||||
map_builder.AddValidityToSignalReference(signal_reference, from_lane, to_lane);
|
||||
}
|
||||
}
|
||||
|
||||
void SignalParser::Parse(
|
||||
const pugi::xml_document &xml,
|
||||
carla::road::MapBuilder &map_builder) {
|
||||
|
||||
// Extracting the OpenDRIVE
|
||||
const pugi::xml_node opendrive_node = xml.child("OpenDRIVE");
|
||||
const std::string validity = "validity";
|
||||
for (pugi::xml_node road_node = opendrive_node.child("road");
|
||||
road_node;
|
||||
road_node = road_node.next_sibling("road")) {
|
||||
const RoadID road_id = static_cast<RoadID>(road_node.attribute("id").as_int());
|
||||
|
||||
road::RoadId road_id = road_node.attribute("id").as_uint();
|
||||
|
||||
const pugi::xml_node signals_node = road_node.child("signals");
|
||||
for (pugi::xml_node signal_node = signals_node.child("signal");
|
||||
signal_node;
|
||||
signal_node = signal_node.next_sibling("signal")) {
|
||||
const double s_position = signal_node.attribute("s").as_double();
|
||||
const double t_position = signal_node.attribute("t").as_double();
|
||||
const SignalID signal_id = static_cast<SignalID>(signal_node.attribute("id").as_int());
|
||||
const road::SignId signal_id = signal_node.attribute("id").value();
|
||||
const std::string name = signal_node.attribute("name").value();
|
||||
const std::string dynamic = signal_node.attribute("dynamic").value();
|
||||
const std::string orientation = signal_node.attribute("orientation").value();
|
||||
|
@ -88,7 +84,9 @@ namespace parser {
|
|||
hOffset,
|
||||
pitch,
|
||||
roll);
|
||||
map_builder.AddSignal(road_id,
|
||||
|
||||
carla::road::Road *road = map_builder.GetRoad(road_id);
|
||||
auto signal_reference = map_builder.AddSignal(road,
|
||||
signal_id,
|
||||
s_position,
|
||||
t_position,
|
||||
|
@ -107,45 +105,39 @@ namespace parser {
|
|||
hOffset,
|
||||
pitch,
|
||||
roll);
|
||||
AddValidity(signal_node, "validity", road_id, signal_id,
|
||||
([&map_builder](auto &&... args)
|
||||
{ map_builder.AddValidityToSignal(args...);
|
||||
}));
|
||||
AddValidity(signal_reference, signal_node, "validity", map_builder);
|
||||
|
||||
for (pugi::xml_node dependency_node = signal_node.child("dependency");
|
||||
dependency_node;
|
||||
dependency_node = dependency_node.next_sibling("validity")) {
|
||||
const DependencyID dependency_id = dependency_node.attribute("id").as_uint();
|
||||
const std::string dependency_id = dependency_node.attribute("id").value();
|
||||
const std::string dependency_type = dependency_node.attribute("type").value();
|
||||
log_debug("Added dependency to signal ", signal_id, ":", dependency_id, dependency_type);
|
||||
map_builder.AddDependencyToSignal(road_id, signal_id, dependency_id, dependency_type);
|
||||
map_builder.AddDependencyToSignal(signal_id, dependency_id, dependency_type);
|
||||
}
|
||||
}
|
||||
for (pugi::xml_node signalreference_node = signals_node.child("signalReference");
|
||||
signalreference_node;
|
||||
signalreference_node = signalreference_node.next_sibling("signalReference")) {
|
||||
const double s_position = signalreference_node.attribute("s").as_double();
|
||||
const double t_position = signalreference_node.attribute("t").as_double();
|
||||
const SignalID signal_reference_id = signalreference_node.attribute("id").as_uint();
|
||||
for (pugi::xml_node signal_reference_node = signals_node.child("signalReference");
|
||||
signal_reference_node;
|
||||
signal_reference_node = signal_reference_node.next_sibling("signalReference")) {
|
||||
const double s_position = signal_reference_node.attribute("s").as_double();
|
||||
const double t_position = signal_reference_node.attribute("t").as_double();
|
||||
const road::SignId signal_id = signal_reference_node.attribute("id").value();
|
||||
const std::string signal_reference_orientation =
|
||||
signalreference_node.attribute("orientation").value();
|
||||
signal_reference_node.attribute("orientation").value();
|
||||
log_debug("Road: ",
|
||||
road_id,
|
||||
"Added SignalReference ",
|
||||
s_position,
|
||||
t_position,
|
||||
signal_reference_id,
|
||||
signal_reference_orientation);
|
||||
map_builder.AddSignalReference(road_id,
|
||||
signal_reference_id,
|
||||
carla::road::Road *road = map_builder.GetRoad(road_id);
|
||||
auto signal_reference = map_builder.AddSignalReference(
|
||||
road,
|
||||
signal_id,
|
||||
s_position,
|
||||
t_position,
|
||||
signal_reference_orientation);
|
||||
AddValidity(signalreference_node, validity, road_id, signal_reference_id,
|
||||
([&map_builder](const RoadID &road_id, const SignalID &signal_id, const int16_t from_lane,
|
||||
const int16_t to_lane)
|
||||
{ map_builder.AddValidityToSignalReference(road_id, signal_id, from_lane, to_lane);
|
||||
}));
|
||||
AddValidity(signal_reference, signal_reference_node, "validity", map_builder);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,30 @@
|
|||
// Copyright (c) 2019 Computer Vision Center (CVC) at the Universitat Autonoma
|
||||
// de Barcelona (UAB).
|
||||
//
|
||||
// This work is licensed under the terms of the MIT license.
|
||||
// For a copy; see <https://opensource.org/licenses/MIT>.
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "carla/NonCopyable.h"
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include "carla/road/RoadTypes.h"
|
||||
|
||||
namespace carla {
|
||||
namespace road {
|
||||
|
||||
struct LaneValidity {
|
||||
public:
|
||||
|
||||
LaneValidity(LaneId from_lane, LaneId to_lane)
|
||||
: _from_lane(from_lane), _to_lane(to_lane) {}
|
||||
|
||||
road::LaneId _from_lane;
|
||||
|
||||
road::LaneId _to_lane;
|
||||
|
||||
};
|
||||
|
||||
} // road
|
||||
} // carla
|
|
@ -12,7 +12,7 @@
|
|||
#include "carla/road/element/RoadInfoLaneWidth.h"
|
||||
#include "carla/road/element/RoadInfoMarkRecord.h"
|
||||
#include "carla/road/element/RoadInfoLaneOffset.h"
|
||||
#include "carla/road/element/RoadObjectCrosswalk.h"
|
||||
#include "carla/road/element/RoadInfoCrosswalk.h"
|
||||
#include "carla/road/element/RoadInfoElevation.h"
|
||||
#include "carla/geom/Math.h"
|
||||
|
||||
|
@ -419,7 +419,7 @@ namespace road {
|
|||
|
||||
for (const auto &pair : _data.GetRoads()) {
|
||||
const auto &road = pair.second;
|
||||
std::vector<const RoadObjectCrosswalk *> crosswalks = road.GetObjects<RoadObjectCrosswalk>();
|
||||
std::vector<const RoadInfoCrosswalk *> crosswalks = road.GetInfos<RoadInfoCrosswalk>();
|
||||
if (crosswalks.size() > 0) {
|
||||
for (auto crosswalk : crosswalks) {
|
||||
// waypoint only at start position
|
||||
|
|
|
@ -19,14 +19,11 @@
|
|||
#include "carla/road/element/RoadInfoMarkRecord.h"
|
||||
#include "carla/road/element/RoadInfoMarkTypeLine.h"
|
||||
#include "carla/road/element/RoadInfoSpeed.h"
|
||||
#include "carla/road/element/RoadInfoSignal.h"
|
||||
#include "carla/road/element/RoadInfoVisitor.h"
|
||||
#include "carla/road/element/RoadObjectCrosswalk.h"
|
||||
#include "carla/road/element/RoadObjectVisitor.h"
|
||||
#include "carla/road/element/RoadInfoCrosswalk.h"
|
||||
#include "carla/road/InformationSet.h"
|
||||
#include "carla/road/general/Validity.h"
|
||||
#include "carla/road/signal/Signal.h"
|
||||
#include "carla/road/signal/SignalReference.h"
|
||||
#include "carla/road/signal/SignalDependency.h"
|
||||
#include "carla/road/Signal.h"
|
||||
|
||||
#include <iterator>
|
||||
#include <memory>
|
||||
|
@ -40,16 +37,13 @@ namespace road {
|
|||
|
||||
CreatePointersBetweenRoadSegments();
|
||||
|
||||
SolveSignalReferences();
|
||||
|
||||
for (auto &&info : _temp_road_info_container) {
|
||||
DEBUG_ASSERT(info.first != nullptr);
|
||||
info.first->_info = InformationSet(std::move(info.second));
|
||||
}
|
||||
|
||||
for (auto &&info : _temp_road_object_container) {
|
||||
DEBUG_ASSERT(info.first != nullptr);
|
||||
info.first->_objects = ObjectSet(std::move(info.second));
|
||||
}
|
||||
|
||||
for (auto &&info : _temp_lane_info_container) {
|
||||
DEBUG_ASSERT(info.first != nullptr);
|
||||
info.first->_info = InformationSet(std::move(info.second));
|
||||
|
@ -57,7 +51,6 @@ namespace road {
|
|||
|
||||
// remove temporal already used information
|
||||
_temp_road_info_container.clear();
|
||||
_temp_road_object_container.clear();
|
||||
_temp_lane_info_container.clear();
|
||||
|
||||
// _map_data is a memeber of MapBuilder so you must especify if
|
||||
|
@ -96,8 +89,8 @@ namespace road {
|
|||
const double length,
|
||||
const std::vector<road::element::CrosswalkPoint> points) {
|
||||
DEBUG_ASSERT(road != nullptr);
|
||||
auto cross = std::make_unique<RoadObjectCrosswalk>(s, name, t, zOffset, hdg, pitch, roll, std::move(orientation), width, length, std::move(points));
|
||||
_temp_road_object_container[road].emplace_back(std::move(cross));
|
||||
auto cross = std::make_unique<RoadInfoCrosswalk>(s, name, t, zOffset, hdg, pitch, roll, std::move(orientation), width, length, std::move(points));
|
||||
_temp_road_info_container[road].emplace_back(std::move(cross));
|
||||
}
|
||||
|
||||
// called from lane parser
|
||||
|
@ -233,66 +226,101 @@ namespace road {
|
|||
_temp_lane_info_container[lane].emplace_back(std::make_unique<RoadInfoSpeed>(s, max));
|
||||
}
|
||||
|
||||
void MapBuilder::AddSignal(
|
||||
const uint32_t road_id,
|
||||
const uint32_t signal_id,
|
||||
const double s,
|
||||
const double t,
|
||||
const std::string name,
|
||||
const std::string dynamic,
|
||||
const std::string orientation,
|
||||
const double zOffset,
|
||||
const std::string country,
|
||||
const std::string type,
|
||||
const std::string subtype,
|
||||
const double value,
|
||||
const std::string unit,
|
||||
const double height,
|
||||
const double width,
|
||||
const std::string text,
|
||||
const double hOffset,
|
||||
const double pitch,
|
||||
const double roll) {
|
||||
auto signals = _map_data.GetRoad(road_id).getSignals();
|
||||
DEBUG_ASSERT(signals != nullptr);
|
||||
signals->emplace(signal_id,
|
||||
signal::Signal(road_id, signal_id, s, t, name, dynamic,
|
||||
orientation, zOffset, country, type, subtype, value, unit, height, width,
|
||||
text, hOffset, pitch, roll));
|
||||
}
|
||||
|
||||
void MapBuilder::AddValidityToLastAddedSignal(
|
||||
const uint32_t road_id,
|
||||
const uint32_t signal_id,
|
||||
const int32_t from_lane,
|
||||
const int32_t to_lane) {
|
||||
_map_data.GetRoad(road_id).GetSignal(signal_id)->AddValidity(general::Validity(signal_id, from_lane,
|
||||
to_lane));
|
||||
}
|
||||
element::RoadInfoSignal* MapBuilder::AddSignal(
|
||||
Road* road,
|
||||
const SignId signal_id,
|
||||
const double s,
|
||||
const double t,
|
||||
const std::string name,
|
||||
const std::string dynamic,
|
||||
const std::string orientation,
|
||||
const double zOffset,
|
||||
const std::string country,
|
||||
const std::string type,
|
||||
const std::string subtype,
|
||||
const double value,
|
||||
const std::string unit,
|
||||
const double height,
|
||||
const double width,
|
||||
const std::string text,
|
||||
const double hOffset,
|
||||
const double pitch,
|
||||
const double roll) {
|
||||
_temp_signal_container[signal_id] = std::make_shared<Signal>(
|
||||
signal_id,
|
||||
s,
|
||||
t,
|
||||
name,
|
||||
dynamic,
|
||||
orientation,
|
||||
zOffset,
|
||||
country,
|
||||
type,
|
||||
subtype,
|
||||
value,
|
||||
unit,
|
||||
height,
|
||||
width,
|
||||
text,
|
||||
hOffset,
|
||||
pitch,
|
||||
roll);
|
||||
|
||||
// build road objects
|
||||
carla::road::Road *MapBuilder::AddRoad(
|
||||
const RoadId road_id,
|
||||
const std::string name,
|
||||
const double length,
|
||||
const JuncId junction_id,
|
||||
const RoadId predecessor,
|
||||
const RoadId successor) {
|
||||
return AddSignalReference(road, signal_id, s, t, orientation);
|
||||
}
|
||||
|
||||
// add it
|
||||
auto road = &(_map_data._roads.emplace(road_id, Road()).first->second);
|
||||
element::RoadInfoSignal* MapBuilder::AddSignalReference(
|
||||
Road* road,
|
||||
const SignId signal_id,
|
||||
const double s_position,
|
||||
const double t_position,
|
||||
const std::string signal_reference_orientation) {
|
||||
|
||||
// set road data
|
||||
road->_map_data = &_map_data;
|
||||
road->_id = road_id;
|
||||
road->_name = name;
|
||||
road->_length = length;
|
||||
road->_junction_id = junction_id;
|
||||
(junction_id != -1) ? road->_is_junction = true : road->_is_junction = false;
|
||||
road->_successor = successor;
|
||||
road->_predecessor = predecessor;
|
||||
_temp_road_info_container[road].emplace_back(std::make_unique<element::RoadInfoSignal>(
|
||||
signal_id, s_position, t_position, signal_reference_orientation));
|
||||
return static_cast<element::RoadInfoSignal*>(_temp_road_info_container[road].back().get());
|
||||
}
|
||||
|
||||
return road;
|
||||
void MapBuilder::AddValidityToSignalReference(
|
||||
element::RoadInfoSignal* signal_reference,
|
||||
const LaneId from_lane,
|
||||
const LaneId to_lane) {
|
||||
signal_reference->_validities.emplace_back(LaneValidity(from_lane, to_lane));
|
||||
}
|
||||
|
||||
void MapBuilder::AddDependencyToSignal(
|
||||
const SignId signal_id,
|
||||
const std::string dependency_id,
|
||||
const std::string dependency_type) {
|
||||
_temp_signal_container[signal_id]->_dependencies.emplace_back(
|
||||
SignalDependency(dependency_id, dependency_type));
|
||||
}
|
||||
|
||||
// build road objects
|
||||
carla::road::Road *MapBuilder::AddRoad(
|
||||
const RoadId road_id,
|
||||
const std::string name,
|
||||
const double length,
|
||||
const JuncId junction_id,
|
||||
const RoadId predecessor,
|
||||
const RoadId successor)
|
||||
{
|
||||
|
||||
// add it
|
||||
auto road = &(_map_data._roads.emplace(road_id, Road()).first->second);
|
||||
|
||||
// set road data
|
||||
road->_map_data = &_map_data;
|
||||
road->_id = road_id;
|
||||
road->_name = name;
|
||||
road->_length = length;
|
||||
road->_junction_id = junction_id;
|
||||
(junction_id != -1) ? road->_is_junction = true : road->_is_junction = false;
|
||||
road->_successor = successor;
|
||||
road->_predecessor = predecessor;
|
||||
|
||||
return road;
|
||||
}
|
||||
|
||||
carla::road::LaneSection *MapBuilder::AddRoadSection(
|
||||
|
@ -390,7 +418,7 @@ namespace road {
|
|||
}
|
||||
|
||||
void MapBuilder::AddRoadGeometrySpiral(
|
||||
carla::road::Road * road,
|
||||
Road * road,
|
||||
const double s,
|
||||
const double x,
|
||||
const double y,
|
||||
|
@ -414,7 +442,7 @@ namespace road {
|
|||
}
|
||||
|
||||
void MapBuilder::AddRoadGeometryPoly3(
|
||||
carla::road::Road * road,
|
||||
Road * road,
|
||||
const double s,
|
||||
const double x,
|
||||
const double y,
|
||||
|
@ -441,7 +469,7 @@ namespace road {
|
|||
}
|
||||
|
||||
void MapBuilder::AddRoadGeometryParamPoly3(
|
||||
carla::road::Road * road,
|
||||
Road * road,
|
||||
const double s,
|
||||
const double x,
|
||||
const double y,
|
||||
|
@ -506,51 +534,6 @@ namespace road {
|
|||
_map_data.GetJunction(junction_id)->GetConnection(connection_id)->AddLaneLink(from, to);
|
||||
}
|
||||
|
||||
void MapBuilder::AddValidityToSignal(
|
||||
const uint32_t road_id,
|
||||
const uint32_t signal_id,
|
||||
const int32_t from_lane,
|
||||
const int32_t to_lane) {
|
||||
DEBUG_ASSERT(_map_data.GetRoad(road_id).GetSignal(signal_id) != nullptr);
|
||||
_map_data.GetRoad(road_id).GetSignal(signal_id)->AddValidity(general::Validity(signal_id, from_lane,
|
||||
to_lane));
|
||||
}
|
||||
|
||||
void MapBuilder::AddValidityToSignalReference(
|
||||
const uint32_t road_id,
|
||||
const uint32_t signal_reference_id,
|
||||
const int32_t from_lane,
|
||||
const int32_t to_lane) {
|
||||
DEBUG_ASSERT(_map_data.GetRoad(road_id).GetSignalRef(signal_reference_id) != nullptr);
|
||||
_map_data.GetRoad(road_id).GetSignalRef(signal_reference_id)->AddValidity(general::Validity(
|
||||
signal_reference_id, from_lane, to_lane));
|
||||
}
|
||||
|
||||
void MapBuilder::AddSignalReference(
|
||||
const uint32_t road_id,
|
||||
const uint32_t signal_reference_id,
|
||||
const double s_position,
|
||||
const double t_position,
|
||||
const std::string signal_reference_orientation) {
|
||||
DEBUG_ASSERT(_map_data.GetRoad(road_id).getSignalReferences() != nullptr);
|
||||
_map_data.GetRoad(road_id).getSignalReferences()->emplace(signal_reference_id,
|
||||
signal::SignalReference(road_id, signal_reference_id, s_position, t_position,
|
||||
signal_reference_orientation));
|
||||
}
|
||||
|
||||
void MapBuilder::AddDependencyToSignal(
|
||||
const RoadId road_id,
|
||||
const SignId signal_id,
|
||||
const uint32_t dependency_id,
|
||||
const std::string dependency_type) {
|
||||
DEBUG_ASSERT(_map_data.GetRoad(road_id).GetSignal(signal_id) != nullptr);
|
||||
_map_data.GetRoad(road_id).GetSignal(signal_id)->AddDependency(signal::SignalDependency(
|
||||
road_id,
|
||||
signal_id,
|
||||
dependency_id,
|
||||
dependency_type));
|
||||
}
|
||||
|
||||
Lane *MapBuilder::GetLane(
|
||||
const RoadId road_id,
|
||||
const LaneId lane_id,
|
||||
|
@ -743,6 +726,14 @@ namespace road {
|
|||
}
|
||||
}
|
||||
|
||||
void MapBuilder::SolveSignalReferences() {
|
||||
for(auto signal_reference : _temp_signal_reference_container){
|
||||
signal_reference->_signal =
|
||||
_temp_signal_container[signal_reference->_signal_id];
|
||||
}
|
||||
_map_data._signals = std::move(_temp_signal_container);
|
||||
}
|
||||
|
||||
void MapBuilder::CreateJunctionBoundingBoxes(Map &map) {
|
||||
for (auto &junctionpair : map._data.GetJunctions()) {
|
||||
auto* junction = map.GetJunction(junctionpair.first);
|
||||
|
|
|
@ -7,7 +7,8 @@
|
|||
#pragma once
|
||||
|
||||
#include "carla/road/Map.h"
|
||||
#include "carla/road/element/RoadObjectCrosswalk.h"
|
||||
#include "carla/road/element/RoadInfoCrosswalk.h"
|
||||
#include "carla/road/element/RoadInfoSignal.h"
|
||||
|
||||
#include <boost/optional.hpp>
|
||||
|
||||
|
@ -150,8 +151,8 @@ namespace road {
|
|||
// const double t);
|
||||
|
||||
// Signal methods
|
||||
void AddSignal(
|
||||
const RoadId road_id,
|
||||
element::RoadInfoSignal* AddSignal(
|
||||
Road* road,
|
||||
const SignId signal_id,
|
||||
const double s,
|
||||
const double t,
|
||||
|
@ -171,12 +172,23 @@ namespace road {
|
|||
const double pitch,
|
||||
const double roll);
|
||||
|
||||
void AddValidityToLastAddedSignal(
|
||||
const RoadId road_id,
|
||||
element::RoadInfoSignal* AddSignalReference(
|
||||
Road* road,
|
||||
const SignId signal_id,
|
||||
const double s_position,
|
||||
const double t_position,
|
||||
const std::string signal_reference_orientation);
|
||||
|
||||
void AddValidityToSignalReference(
|
||||
element::RoadInfoSignal* signal_reference,
|
||||
const LaneId from_lane,
|
||||
const LaneId to_lane);
|
||||
|
||||
void AddDependencyToSignal(
|
||||
const SignId signal_id,
|
||||
const std::string dependency_id,
|
||||
const std::string dependency_type);
|
||||
|
||||
// called from junction parser
|
||||
void AddJunction(
|
||||
const JuncId id,
|
||||
|
@ -305,31 +317,6 @@ namespace road {
|
|||
const double max,
|
||||
const std::string unit);
|
||||
|
||||
void AddValidityToSignal(
|
||||
const RoadId road_id,
|
||||
const SignId signal_id,
|
||||
const LaneId from_lane,
|
||||
const LaneId to_lane);
|
||||
|
||||
void AddValidityToSignalReference(
|
||||
const RoadId road_id,
|
||||
const SignId signal_reference_id,
|
||||
const LaneId from_lane,
|
||||
const LaneId to_lane);
|
||||
|
||||
void AddSignalReference(
|
||||
const RoadId road_id,
|
||||
const SignId signal_reference_id,
|
||||
const double s_position,
|
||||
const double t_position,
|
||||
const std::string signal_reference_orientation);
|
||||
|
||||
void AddDependencyToSignal(
|
||||
const RoadId road_id,
|
||||
const SignId signal_id,
|
||||
const uint32_t dependency_id,
|
||||
const std::string dependency_type);
|
||||
|
||||
Road *GetRoad(
|
||||
const RoadId road_id);
|
||||
|
||||
|
@ -352,6 +339,9 @@ namespace road {
|
|||
/// Create the bounding boxes of each junction
|
||||
void CreateJunctionBoundingBoxes(Map &map);
|
||||
|
||||
/// Solves the signal references in the road
|
||||
void SolveSignalReferences();
|
||||
|
||||
/// Return the pointer to a lane object.
|
||||
Lane *GetEdgeLanePointer(RoadId road_id, bool from_start, LaneId lane_id);
|
||||
|
||||
|
@ -370,13 +360,15 @@ namespace road {
|
|||
/// Map to temporary store all the road and lane infos until the map is
|
||||
/// built, so they can be added all together.
|
||||
std::unordered_map<Road *, std::vector<std::unique_ptr<element::RoadInfo>>>
|
||||
_temp_road_info_container;
|
||||
|
||||
std::unordered_map<Road *, std::vector<std::unique_ptr<element::RoadObject>>>
|
||||
_temp_road_object_container;
|
||||
_temp_road_info_container;
|
||||
|
||||
std::unordered_map<Lane *, std::vector<std::unique_ptr<element::RoadInfo>>>
|
||||
_temp_lane_info_container;
|
||||
_temp_lane_info_container;
|
||||
|
||||
std::unordered_map<SignId, std::shared_ptr<Signal>>
|
||||
_temp_signal_container;
|
||||
|
||||
std::vector<element::RoadInfoSignal*> _temp_signal_reference_container;
|
||||
|
||||
};
|
||||
|
||||
|
|
|
@ -14,6 +14,7 @@
|
|||
#include "carla/road/Road.h"
|
||||
#include "carla/road/RoadTypes.h"
|
||||
#include "carla/road/element/RoadInfo.h"
|
||||
#include "carla/road/Signal.h"
|
||||
|
||||
#include <boost/iterator/transform_iterator.hpp>
|
||||
|
||||
|
@ -80,6 +81,8 @@ namespace road {
|
|||
std::unordered_map<RoadId, Road> _roads;
|
||||
|
||||
std::unordered_map<JuncId, Junction> _junctions;
|
||||
|
||||
std::unordered_map<SignId, std::shared_ptr<Signal>> _signals;
|
||||
};
|
||||
|
||||
} // namespace road
|
||||
|
|
|
@ -1,53 +0,0 @@
|
|||
// Copyright (c) 2019 Computer Vision Center (CVC) at the Universitat Autonoma
|
||||
// de Barcelona (UAB).
|
||||
//
|
||||
// This work is licensed under the terms of the MIT license.
|
||||
// For a copy, see <https://opensource.org/licenses/MIT>.
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "carla/NonCopyable.h"
|
||||
#include "carla/road/RoadElementSet.h"
|
||||
#include "carla/road/element/RoadObject.h"
|
||||
#include "carla/road/element/RoadObjectIterator.h"
|
||||
|
||||
#include <vector>
|
||||
#include <memory>
|
||||
|
||||
namespace carla {
|
||||
namespace road {
|
||||
|
||||
class ObjectSet : private MovableNonCopyable {
|
||||
public:
|
||||
|
||||
ObjectSet() = default;
|
||||
|
||||
ObjectSet(std::vector<std::unique_ptr<element::RoadObject>> &&vec)
|
||||
: _road_set(std::move(vec)) {}
|
||||
|
||||
/// Return all objects given a type from the start of the road
|
||||
template <typename T>
|
||||
std::vector<const T *> GetObjects() const {
|
||||
std::vector<const T *> vec;
|
||||
auto it = element::MakeRoadObjectIterator<T>(_road_set.GetAll());
|
||||
for (; !it.IsAtEnd(); ++it) {
|
||||
vec.emplace_back(&*it);
|
||||
}
|
||||
return vec;
|
||||
}
|
||||
|
||||
/// Returns single object given a type and a distance (s) from
|
||||
/// the start of the road
|
||||
template <typename T>
|
||||
const T *GetObject(const double s) const {
|
||||
auto it = element::MakeRoadObjectIterator<T>(_road_set.GetReverseSubset(s));
|
||||
return it.IsAtEnd() ? nullptr : &*it;
|
||||
}
|
||||
|
||||
private:
|
||||
|
||||
RoadElementSet<std::unique_ptr<element::RoadObject>> _road_set;
|
||||
};
|
||||
|
||||
} // road
|
||||
} // carla
|
|
@ -155,30 +155,6 @@ namespace road {
|
|||
return nullptr;
|
||||
}
|
||||
|
||||
carla::road::signal::Signal *Road::GetSignal(const SignId id) {
|
||||
auto search = _signals.find(id);
|
||||
if (search != _signals.end()) {
|
||||
return &search->second;
|
||||
}
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
carla::road::signal::SignalReference *Road::GetSignalRef(const SignRefId id) {
|
||||
const auto search = _sign_ref.find(id);
|
||||
if (search != _sign_ref.end()) {
|
||||
return &search->second;
|
||||
}
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
std::unordered_map<SignId, signal::Signal> *Road::getSignals() {
|
||||
return &_signals;
|
||||
}
|
||||
|
||||
std::unordered_map<SignId, signal::SignalReference> *Road::getSignalReferences() {
|
||||
return &_sign_ref;
|
||||
}
|
||||
|
||||
element::DirectedPoint Road::GetDirectedPointIn(const double s) const {
|
||||
const auto clamped_s = geom::Math::Clamp(s, 0.0, _length);
|
||||
const auto geometry = _info.GetInfo<element::RoadInfoGeometry>(clamped_s);
|
||||
|
|
|
@ -10,7 +10,6 @@
|
|||
#include "carla/ListView.h"
|
||||
#include "carla/NonCopyable.h"
|
||||
#include "carla/road/InformationSet.h"
|
||||
#include "carla/road/ObjectSet.h"
|
||||
#include "carla/road/Junction.h"
|
||||
#include "carla/road/LaneSection.h"
|
||||
#include "carla/road/LaneSectionMap.h"
|
||||
|
@ -18,9 +17,6 @@
|
|||
#include "carla/road/RoadTypes.h"
|
||||
#include "carla/road/element/Geometry.h"
|
||||
#include "carla/road/element/RoadInfo.h"
|
||||
#include "carla/road/element/RoadObject.h"
|
||||
#include "carla/road/signal/Signal.h"
|
||||
#include "carla/road/signal/SignalReference.h"
|
||||
|
||||
#include <unordered_map>
|
||||
#include <vector>
|
||||
|
@ -77,14 +73,6 @@ namespace road {
|
|||
|
||||
const geom::CubicPolynomial &GetElevationOn(const double s) const;
|
||||
|
||||
carla::road::signal::Signal *GetSignal(const SignId id);
|
||||
|
||||
carla::road::signal::SignalReference *GetSignalRef(const SignRefId id);
|
||||
|
||||
std::unordered_map<SignId, signal::Signal> *getSignals();
|
||||
|
||||
std::unordered_map<SignId, signal::SignalReference> *getSignalReferences();
|
||||
|
||||
/// Returns a directed point on the center of the road (lane 0),
|
||||
/// with the corresponding laneOffset and elevation records applied,
|
||||
/// on distance "s".
|
||||
|
@ -120,16 +108,6 @@ namespace road {
|
|||
return _info.GetInfos<T>();
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
const T *GetObject(const double s) const {
|
||||
return _objects.GetObject<T>(s);
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
std::vector<const T *> GetObjects() const {
|
||||
return _objects.GetObjects<T>();
|
||||
}
|
||||
|
||||
auto GetLaneSections() const {
|
||||
return MakeListView(
|
||||
iterator::make_map_values_const_iterator(_lane_sections.begin()),
|
||||
|
@ -211,13 +189,6 @@ namespace road {
|
|||
std::vector<Road *> _nexts;
|
||||
|
||||
std::vector<Road *> _prevs;
|
||||
|
||||
std::unordered_map<SignId, signal::Signal> _signals;
|
||||
|
||||
std::unordered_map<SignRefId, signal::SignalReference> _sign_ref;
|
||||
|
||||
ObjectSet _objects;
|
||||
|
||||
};
|
||||
|
||||
} // road
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
#pragma once
|
||||
|
||||
#include <cstdint>
|
||||
#include <string>
|
||||
|
||||
namespace carla {
|
||||
namespace road {
|
||||
|
@ -21,9 +22,7 @@ namespace road {
|
|||
|
||||
using ObjId = uint32_t;
|
||||
|
||||
using SignId = uint32_t;
|
||||
|
||||
using SignRefId = uint32_t;
|
||||
using SignId = std::string;
|
||||
|
||||
using ConId = uint32_t;
|
||||
|
||||
|
|
|
@ -6,24 +6,33 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include "carla/Memory.h"
|
||||
#include "carla/NonCopyable.h"
|
||||
#include "carla/road/RoadTypes.h"
|
||||
#include "carla/road/general/Validity.h"
|
||||
#include "carla/road/signal/SignalDependency.h"
|
||||
#include "carla/road/LaneValidity.h"
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
namespace carla {
|
||||
namespace road {
|
||||
namespace signal {
|
||||
|
||||
struct SignalDependency {
|
||||
public:
|
||||
|
||||
SignalDependency( std::string dependency_id, std::string type)
|
||||
: _dependency_id(dependency_id), _type(type) {}
|
||||
|
||||
std::string _dependency_id;
|
||||
|
||||
std::string _type;
|
||||
|
||||
};
|
||||
|
||||
class Signal : private MovableNonCopyable {
|
||||
public:
|
||||
|
||||
Signal(
|
||||
road::RoadId road_id,
|
||||
road::SignId signal_id,
|
||||
SignId signal_id,
|
||||
double s,
|
||||
double t,
|
||||
std::string name,
|
||||
|
@ -41,8 +50,7 @@ namespace signal {
|
|||
double hOffset,
|
||||
double pitch,
|
||||
double roll)
|
||||
: _road_id(road_id),
|
||||
_signal_id(signal_id),
|
||||
: _signal_id(signal_id),
|
||||
_s(s),
|
||||
_t(t),
|
||||
_name(name),
|
||||
|
@ -61,46 +69,55 @@ namespace signal {
|
|||
_pitch(pitch),
|
||||
_roll(roll) {}
|
||||
|
||||
void AddValidity(general::Validity &&validity) {
|
||||
void AddValidity(LaneValidity &&validity) {
|
||||
_validities.push_back(std::move(validity));
|
||||
}
|
||||
|
||||
void AddDependency(signal::SignalDependency &&dependency) {
|
||||
void AddDependency(SignalDependency &&dependency) {
|
||||
_dependencies.push_back(std::move(dependency));
|
||||
}
|
||||
|
||||
private:
|
||||
SignId _signal_id;
|
||||
|
||||
#if defined(__clang__)
|
||||
# pragma clang diagnostic push
|
||||
# pragma clang diagnostic ignored "-Wunused-private-field"
|
||||
#endif
|
||||
road::RoadId _road_id;
|
||||
road::SignId _signal_id;
|
||||
double _s;
|
||||
|
||||
double _t;
|
||||
|
||||
std::string _name;
|
||||
|
||||
std::string _dynamic;
|
||||
|
||||
std::string _orientation;
|
||||
|
||||
double _zOffset;
|
||||
|
||||
std::string _country;
|
||||
|
||||
std::string _type;
|
||||
|
||||
std::string _subtype;
|
||||
|
||||
double _value;
|
||||
|
||||
std::string _unit;
|
||||
|
||||
double _height;
|
||||
|
||||
double _width;
|
||||
|
||||
std::string _text;
|
||||
|
||||
double _hOffset;
|
||||
|
||||
double _pitch;
|
||||
|
||||
double _roll;
|
||||
std::vector<general::Validity> _validities;
|
||||
std::vector<signal::SignalDependency> _dependencies;
|
||||
#if defined(__clang__)
|
||||
# pragma clang diagnostic pop
|
||||
#endif
|
||||
|
||||
std::vector<LaneValidity> _validities;
|
||||
|
||||
std::vector<SignalDependency> _dependencies;
|
||||
|
||||
};
|
||||
|
||||
} // object
|
||||
} // road
|
||||
} // carla
|
|
@ -6,7 +6,7 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include "carla/road/element/RoadObject.h"
|
||||
#include "carla/road/element/RoadInfo.h"
|
||||
|
||||
namespace carla {
|
||||
namespace road {
|
||||
|
@ -19,10 +19,10 @@ namespace element {
|
|||
CrosswalkPoint(double _u, double _v, double _z) : u(_u), v(_v), z(_z) {};
|
||||
};
|
||||
|
||||
class RoadObjectCrosswalk final : public RoadObject {
|
||||
class RoadInfoCrosswalk final : public RoadInfo {
|
||||
public:
|
||||
|
||||
RoadObjectCrosswalk(
|
||||
RoadInfoCrosswalk(
|
||||
const double s,
|
||||
const std::string name,
|
||||
const double t,
|
||||
|
@ -34,7 +34,7 @@ namespace element {
|
|||
const double width,
|
||||
const double length,
|
||||
const std::vector<CrosswalkPoint> points)
|
||||
: RoadObject(s),
|
||||
: RoadInfo(s),
|
||||
_name(name),
|
||||
_t(t),
|
||||
_zOffset(zOffset),
|
||||
|
@ -46,7 +46,7 @@ namespace element {
|
|||
_length(length),
|
||||
_points(points) {}
|
||||
|
||||
void AcceptVisitor(RoadObjectVisitor &v) final {
|
||||
void AcceptVisitor(RoadInfoVisitor &v) final {
|
||||
v.Visit(*this);
|
||||
}
|
||||
|
|
@ -0,0 +1,69 @@
|
|||
// Copyright (c) 2020 Computer Vision Center (CVC) at the Universitat Autonoma
|
||||
// de Barcelona (UAB).
|
||||
//
|
||||
// This work is licensed under the terms of the MIT license.
|
||||
// For a copy, see <https://opensource.org/licenses/MIT>.
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "carla/road/Signal.h"
|
||||
#include "carla/road/element/RoadInfo.h"
|
||||
|
||||
namespace carla {
|
||||
namespace road {
|
||||
namespace element {
|
||||
|
||||
class RoadInfoSignal final : public RoadInfo {
|
||||
public:
|
||||
|
||||
RoadInfoSignal(
|
||||
SignId signal_id,
|
||||
std::shared_ptr<Signal> &signal,
|
||||
double s,
|
||||
double t,
|
||||
std::string orientation)
|
||||
: _signal_id(signal_id),
|
||||
_signal(signal),
|
||||
_s(s),
|
||||
_t(t),
|
||||
_orientation(orientation) {}
|
||||
|
||||
RoadInfoSignal(
|
||||
SignId signal_id,
|
||||
double s,
|
||||
double t,
|
||||
std::string orientation)
|
||||
: _signal_id(signal_id),
|
||||
_s(s),
|
||||
_t(t),
|
||||
_orientation(orientation) {}
|
||||
|
||||
void AcceptVisitor(RoadInfoVisitor &v) final {
|
||||
v.Visit(*this);
|
||||
}
|
||||
|
||||
const std::shared_ptr<Signal>& GetSignal() const {
|
||||
return _signal;
|
||||
}
|
||||
|
||||
|
||||
|
||||
private:
|
||||
friend MapBuilder;
|
||||
|
||||
SignId _signal_id;
|
||||
|
||||
std::shared_ptr<Signal> _signal;
|
||||
|
||||
double _s;
|
||||
|
||||
double _t;
|
||||
|
||||
std::string _orientation;
|
||||
|
||||
std::vector<LaneValidity> _validities;
|
||||
};
|
||||
|
||||
} // namespace element
|
||||
} // namespace road
|
||||
} // namespace carla
|
|
@ -25,6 +25,8 @@ namespace element {
|
|||
class RoadInfoMarkRecord;
|
||||
class RoadInfoMarkTypeLine;
|
||||
class RoadInfoSpeed;
|
||||
class RoadInfoCrosswalk;
|
||||
class RoadInfoSignal;
|
||||
|
||||
class RoadInfoVisitor {
|
||||
public:
|
||||
|
@ -52,6 +54,8 @@ namespace element {
|
|||
virtual void Visit(RoadInfoMarkRecord &) {}
|
||||
virtual void Visit(RoadInfoMarkTypeLine &) {}
|
||||
virtual void Visit(RoadInfoSpeed &) {}
|
||||
virtual void Visit(RoadInfoCrosswalk &) {}
|
||||
virtual void Visit(RoadInfoSignal &) {}
|
||||
};
|
||||
|
||||
} // namespace element
|
||||
|
|
|
@ -1,43 +0,0 @@
|
|||
// Copyright (c) 2017 Computer Vision Center (CVC) at the Universitat Autonoma
|
||||
// de Barcelona (UAB).
|
||||
//
|
||||
// This work is licensed under the terms of the MIT license.
|
||||
// For a copy, see <https://opensource.org/licenses/MIT>.
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "carla/road/element/RoadObjectVisitor.h"
|
||||
#include "carla/NonCopyable.h"
|
||||
|
||||
#include <map>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
namespace carla {
|
||||
namespace road {
|
||||
namespace element {
|
||||
|
||||
class RoadObject : private NonCopyable {
|
||||
public:
|
||||
|
||||
virtual ~RoadObject() = default;
|
||||
|
||||
virtual void AcceptVisitor(RoadObjectVisitor &) = 0;
|
||||
|
||||
/// Distance from road's start location.
|
||||
double GetDistance() const {
|
||||
return _s;
|
||||
}
|
||||
|
||||
protected:
|
||||
|
||||
RoadObject(double distance = 0.0) : _s(distance) {}
|
||||
|
||||
private:
|
||||
|
||||
double _s;
|
||||
};
|
||||
|
||||
} // namespace element
|
||||
} // namespace road
|
||||
} // namespace carla
|
|
@ -1,105 +0,0 @@
|
|||
// Copyright (c) 2019 Computer Vision Center (CVC) at the Universitat Autonoma
|
||||
// de Barcelona (UAB).
|
||||
//
|
||||
// This work is licensed under the terms of the MIT license.
|
||||
// For a copy, see <https://opensource.org/licenses/MIT>.
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "carla/Debug.h"
|
||||
#include "carla/road/element/RoadObjectVisitor.h"
|
||||
|
||||
#include <iterator>
|
||||
#include <memory>
|
||||
|
||||
namespace carla {
|
||||
namespace road {
|
||||
namespace element {
|
||||
|
||||
template <typename T, typename IT>
|
||||
class RoadObjectIterator : private RoadObjectVisitor {
|
||||
public:
|
||||
|
||||
static_assert(std::is_same<std::unique_ptr<RoadObject>, typename IT::value_type>::value, "Not compatible.");
|
||||
|
||||
using value_type = T;
|
||||
using difference_type = typename IT::difference_type;
|
||||
using pointer = T *;
|
||||
using reference = T &;
|
||||
|
||||
RoadObjectIterator(IT begin, IT end)
|
||||
: _it(begin),
|
||||
_end(end) {
|
||||
_success = false;
|
||||
for (; !IsAtEnd(); ++_it) {
|
||||
DEBUG_ASSERT((*_it) != nullptr);
|
||||
(*_it)->AcceptVisitor(*this);
|
||||
if (_success) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
RoadObjectIterator &operator++() {
|
||||
_success = false;
|
||||
while (!_success) {
|
||||
++_it;
|
||||
if (IsAtEnd()) {
|
||||
break;
|
||||
}
|
||||
DEBUG_ASSERT((*_it) != nullptr);
|
||||
(*_it)->AcceptVisitor(*this);
|
||||
}
|
||||
return *this;
|
||||
}
|
||||
|
||||
reference operator*() const {
|
||||
DEBUG_ASSERT((*_it) != nullptr);
|
||||
return static_cast<T &>(**_it);
|
||||
}
|
||||
|
||||
pointer operator->() const {
|
||||
DEBUG_ASSERT((*_it) != nullptr);
|
||||
return static_cast<T *>(_it->get());
|
||||
}
|
||||
|
||||
bool operator!=(const RoadObjectIterator &rhs) const {
|
||||
return _it != rhs._it;
|
||||
}
|
||||
|
||||
bool operator==(const RoadObjectIterator &rhs) const {
|
||||
return !((*this) != rhs);
|
||||
}
|
||||
|
||||
bool IsAtEnd() const {
|
||||
return _it == _end;
|
||||
}
|
||||
|
||||
private:
|
||||
|
||||
void Visit(T &) {
|
||||
_success = true;
|
||||
}
|
||||
|
||||
IT _it;
|
||||
|
||||
IT _end;
|
||||
|
||||
bool _success;
|
||||
};
|
||||
|
||||
template <typename T, typename Container>
|
||||
static auto MakeRoadObjectIterator(const Container &c) {
|
||||
auto begin = std::begin(c);
|
||||
auto end = std::end(c);
|
||||
return RoadObjectIterator<T, decltype(begin)>(begin, end);
|
||||
}
|
||||
|
||||
template <typename T, typename IT>
|
||||
static auto MakeRoadObjectIterator(IT begin, IT end) {
|
||||
return RoadObjectIterator<T, decltype(begin)>(begin, end);
|
||||
}
|
||||
|
||||
} // namespace element
|
||||
} // namespace road
|
||||
} // namespace carla
|
|
@ -1,33 +0,0 @@
|
|||
// Copyright (c) 2017 Computer Vision Center (CVC) at the Universitat Autonoma
|
||||
// de Barcelona (UAB).
|
||||
//
|
||||
// This work is licensed under the terms of the MIT license.
|
||||
// For a copy, see <https://opensource.org/licenses/MIT>.
|
||||
|
||||
#pragma once
|
||||
|
||||
namespace carla {
|
||||
namespace road {
|
||||
namespace element {
|
||||
|
||||
class RoadObject;
|
||||
class RoadObjectCrosswalk;
|
||||
|
||||
class RoadObjectVisitor {
|
||||
public:
|
||||
|
||||
RoadObjectVisitor() = default;
|
||||
virtual ~RoadObjectVisitor() = default;
|
||||
|
||||
RoadObjectVisitor(const RoadObjectVisitor &) = default;
|
||||
RoadObjectVisitor(RoadObjectVisitor &&) = default;
|
||||
|
||||
RoadObjectVisitor &operator=(const RoadObjectVisitor &) = default;
|
||||
RoadObjectVisitor &operator=(RoadObjectVisitor &&) = default;
|
||||
|
||||
virtual void Visit(RoadObjectCrosswalk &) {}
|
||||
};
|
||||
|
||||
} // namespace element
|
||||
} // namespace road
|
||||
} // namespace carla
|
|
@ -1,45 +0,0 @@
|
|||
// Copyright (c) 2019 Computer Vision Center (CVC) at the Universitat Autonoma
|
||||
// de Barcelona (UAB).
|
||||
//
|
||||
// This work is licensed under the terms of the MIT license.
|
||||
// For a copy; see <https://opensource.org/licenses/MIT>.
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "carla/NonCopyable.h"
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include "carla/road/RoadTypes.h"
|
||||
|
||||
namespace carla {
|
||||
namespace road {
|
||||
namespace general {
|
||||
|
||||
class Validity : private MovableNonCopyable {
|
||||
public:
|
||||
|
||||
Validity(
|
||||
uint32_t parent_id,
|
||||
road::LaneId from_lane,
|
||||
road::LaneId to_lane)
|
||||
: _parent_id(parent_id),
|
||||
_from_lane(from_lane),
|
||||
_to_lane(to_lane) {}
|
||||
|
||||
private:
|
||||
|
||||
#if defined(__clang__)
|
||||
# pragma clang diagnostic push
|
||||
# pragma clang diagnostic ignored "-Wunused-private-field"
|
||||
#endif
|
||||
uint32_t _parent_id;
|
||||
road::LaneId _from_lane;
|
||||
road::LaneId _to_lane;
|
||||
#if defined(__clang__)
|
||||
# pragma clang diagnostic pop
|
||||
#endif
|
||||
};
|
||||
|
||||
} // general
|
||||
} // road
|
||||
} // carla
|
|
@ -1,50 +0,0 @@
|
|||
// Copyright (c) 2019 Computer Vision Center (CVC) at the Universitat Autonoma
|
||||
// de Barcelona (UAB).
|
||||
//
|
||||
// This work is licensed under the terms of the MIT license.
|
||||
// For a copy; see <https://opensource.org/licenses/MIT>.
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "carla/NonCopyable.h"
|
||||
#include "carla/road/RoadTypes.h"
|
||||
#include "carla/road/general/Validity.h"
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
namespace carla {
|
||||
namespace road {
|
||||
namespace signal {
|
||||
|
||||
class SignalDependency : private MovableNonCopyable {
|
||||
public:
|
||||
|
||||
SignalDependency(
|
||||
road::RoadId road_id,
|
||||
road::SignId signal_id,
|
||||
uint32_t dependency_id,
|
||||
std::string type)
|
||||
: _road_id(road_id),
|
||||
_signal_id(signal_id),
|
||||
_dependency_id(dependency_id),
|
||||
_type(type) {}
|
||||
|
||||
private:
|
||||
|
||||
#if defined(__clang__)
|
||||
# pragma clang diagnostic push
|
||||
# pragma clang diagnostic ignored "-Wunused-private-field"
|
||||
#endif
|
||||
road::RoadId _road_id;
|
||||
road::SignId _signal_id;
|
||||
uint32_t _dependency_id;
|
||||
std::string _type;
|
||||
#if defined(__clang__)
|
||||
# pragma clang diagnostic pop
|
||||
#endif
|
||||
};
|
||||
|
||||
} // object
|
||||
} // road
|
||||
} // carla
|
|
@ -1,57 +0,0 @@
|
|||
// Copyright (c) 2019 Computer Vision Center (CVC) at the Universitat Autonoma
|
||||
// de Barcelona (UAB).
|
||||
//
|
||||
// This work is licensed under the terms of the MIT license.
|
||||
// For a copy; see <https://opensource.org/licenses/MIT>.
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "carla/NonCopyable.h"
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include "carla/road/RoadTypes.h"
|
||||
#include "carla/road/general/Validity.h"
|
||||
|
||||
namespace carla {
|
||||
namespace road {
|
||||
namespace signal {
|
||||
|
||||
class SignalReference : private MovableNonCopyable {
|
||||
public:
|
||||
|
||||
SignalReference(
|
||||
road::RoadId road_id,
|
||||
road::SignId id,
|
||||
double s,
|
||||
double t,
|
||||
std::string orientation)
|
||||
: _road_id(road_id),
|
||||
_signal_id(id),
|
||||
_s(s),
|
||||
_t(t),
|
||||
_orientation(orientation) {}
|
||||
|
||||
void AddValidity(general::Validity &&validity) {
|
||||
_validities.push_back(std::move(validity));
|
||||
}
|
||||
|
||||
private:
|
||||
|
||||
#if defined(__clang__)
|
||||
# pragma clang diagnostic push
|
||||
# pragma clang diagnostic ignored "-Wunused-private-field"
|
||||
#endif
|
||||
road::RoadId _road_id;
|
||||
road::SignId _signal_id;
|
||||
double _s;
|
||||
double _t;
|
||||
std::string _orientation;
|
||||
std::vector<general::Validity> _validities;
|
||||
#if defined(__clang__)
|
||||
# pragma clang diagnostic pop
|
||||
#endif
|
||||
};
|
||||
|
||||
} // object
|
||||
} // road
|
||||
} // carla
|
Loading…
Reference in New Issue